Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 111 - 120 of 127 for mediaType (0.06 seconds)

  1. docs/tr/docs/advanced/stream-data.md

    Akıttığınız veri türüne uygun `Content-Type` header'ını ayarlayan, `StreamingResponse`'tan türetilmiş özel bir alt sınıf (subclass) oluşturabilirsiniz.
    
    Örneğin, `media_type` özniteliğini kullanarak `Content-Type` header'ını `image/png` olarak ayarlayan bir `PNGStreamingResponse` oluşturabilirsiniz:
    
    {* ../../docs_src/stream_data/tutorial002_py310.py ln[6,19:20] hl[20] *}
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:51:35 GMT 2026
    - 5.8K bytes
    - Click Count (0)
  2. fastapi/sse.py

        with protocols like MCP that stream SSE over `POST`.
    
        The actual encoding logic lives in the FastAPI routing layer. This class
        serves mainly as a marker and sets the correct `Content-Type`.
        """
    
        media_type = "text/event-stream"
    
    
    def _check_id_no_null(v: str | None) -> str | None:
        if v is not None and "\0" in v:
            raise ValueError("SSE 'id' must not contain null characters")
        return v
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 09:21:52 GMT 2026
    - 6.2K bytes
    - Click Count (0)
  3. tests/test_extra_routes.py

    @app.patch("/items/{item_id}")
    def patch_item(item_id: str, item: Item):
        return {"item_id": item_id, "item": item}
    
    
    @app.trace("/items/{item_id}")
    def trace_item(item_id: str):
        return JSONResponse(None, media_type="message/http")
    
    
    client = TestClient(app)
    
    
    def test_get_api_route():
        response = client.get("/items/foo")
        assert response.status_code == 200, response.text
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 14.7K bytes
    - Click Count (0)
  4. docs/de/docs/advanced/response-directly.md

    Stattdessen nimmt es die von Pydantic mithilfe des Responsemodells (oder Rückgabetyps) generierten JSON-Bytes und gibt direkt eine `Response` mit dem richtigen Mediatyp für JSON (`application/json`) zurück.
    
    ## Anmerkungen { #notes }
    
    Wenn Sie eine `Response` direkt zurücksenden, werden deren Daten weder validiert, konvertiert (serialisiert), noch automatisch dokumentiert.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 17:58:09 GMT 2026
    - 4.8K bytes
    - Click Count (0)
  5. docs/pt/docs/advanced/stream-data.md

    Por exemplo, você pode criar um `PNGStreamingResponse` que define o cabeçalho `Content-Type` como `image/png` usando o atributo `media_type`:
    
    {* ../../docs_src/stream_data/tutorial002_py310.py ln[6,19:20] hl[20] *}
    
    Em seguida, você pode usar essa nova classe em `response_class=PNGStreamingResponse` na sua função de operação de rota:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:20:13 GMT 2026
    - 5.7K bytes
    - Click Count (0)
  6. docs/es/docs/advanced/stream-data.md

    Por ejemplo, puedes crear un `PNGStreamingResponse` que establezca el header `Content-Type` a `image/png` usando el atributo `media_type`:
    
    {* ../../docs_src/stream_data/tutorial002_py310.py ln[6,19:20] hl[20] *}
    
    Luego puedes usar esta nueva clase en `response_class=PNGStreamingResponse` en tu *path operation function*:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:12:26 GMT 2026
    - 5.7K bytes
    - Click Count (0)
  7. docs/en/docs/advanced/stream-data.md

    For example, you can create a `PNGStreamingResponse` that sets the `Content-Type` header to `image/png` using the `media_type` attribute:
    
    {* ../../docs_src/stream_data/tutorial002_py310.py ln[6,19:20] hl[20] *}
    
    Then you can use this new class in `response_class=PNGStreamingResponse` in your *path operation function*:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 5.4K bytes
    - Click Count (0)
  8. docs/fr/docs/advanced/stream-data.md

    Par exemple, vous pouvez créer une `PNGStreamingResponse` qui définit l'en-tête `Content-Type` à `image/png` en utilisant l'attribut `media_type` :
    
    {* ../../docs_src/stream_data/tutorial002_py310.py ln[6,19:20] hl[20] *}
    
    Vous pouvez ensuite utiliser cette nouvelle classe dans `response_class=PNGStreamingResponse` dans votre *fonction de chemin d'accès* :
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:33:45 GMT 2026
    - 6.2K bytes
    - Click Count (0)
  9. docs/zh-hant/docs/advanced/stream-data.md

    在上述範例中,雖然串流了資料位元組,但回應沒有 `Content-Type` 標頭,因此用戶端不知道接收到的是哪種資料型別。
    
    你可以建立 `StreamingResponse` 的自訂子類別,將 `Content-Type` 標頭設定為你要串流的資料型別。
    
    例如,你可以建立 `PNGStreamingResponse`,透過 `media_type` 屬性把 `Content-Type` 設為 `image/png`:
    
    {* ../../docs_src/stream_data/tutorial002_py310.py ln[6,19:20] hl[20] *}
    
    接著在路徑操作函式中用 `response_class=PNGStreamingResponse` 使用這個新類別:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:33:04 GMT 2026
    - 4.9K bytes
    - Click Count (0)
  10. docs/zh/docs/advanced/stream-data.md

    在上面的示例中,虽然按字节流式传输了数据,但响应没有 `Content-Type` 头,因此客户端不知道接收到的数据类型。
    
    你可以创建 `StreamingResponse` 的自定义子类,将 `Content-Type` 头设置为你要流式传输的数据类型。
    
    例如,你可以创建一个 `PNGStreamingResponse`,通过 `media_type` 属性把 `Content-Type` 头设置为 `image/png`:
    
    {* ../../docs_src/stream_data/tutorial002_py310.py ln[6,19:20] hl[20] *}
    
    然后你可以在*路径操作函数*中通过 `response_class=PNGStreamingResponse` 使用这个新类:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:29:48 GMT 2026
    - 5.2K bytes
    - Click Count (0)
Back to Top