Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 1,698 for responses (0.31 sec)

  1. tests/test_response_model_sub_types.py

    
    def test_path_operations():
        response = client.get("/valid1")
        assert response.status_code == 200, response.text
        response = client.get("/valid2")
        assert response.status_code == 200, response.text
        response = client.get("/valid3")
        assert response.status_code == 200, response.text
        response = client.get("/valid4")
        assert response.status_code == 200, response.text
    
    
    def test_openapi_schema():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 5.3K bytes
    - Viewed (0)
  2. docs/de/docs/advanced/custom-response.md

    !!! note "Technische Details"
        Sie können auch `from starlette.responses import HTMLResponse` verwenden.
    
        **FastAPI** bietet dieselben `starlette.responses` auch via `fastapi.responses` an, als Annehmlichkeit für Sie, den Entwickler. Die meisten verfügbaren Responses kommen aber direkt von Starlette.
    
    ### `Response`
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 23 13:05:12 GMT 2024
    - 13.5K bytes
    - Viewed (0)
  3. docs/en/docs/advanced/response-directly.md

    ```Python hl_lines="6-7  21-22"
    {!../../../docs_src/response_directly/tutorial001.py!}
    ```
    
    !!! note "Technical Details"
        You could also use `from starlette.responses import JSONResponse`.
    
        **FastAPI** provides the same `starlette.responses` as `fastapi.responses` just as a convenience for you, the developer. But most of the available responses come directly from Starlette.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Aug 29 14:02:58 GMT 2020
    - 3K bytes
    - Viewed (0)
  4. docs/en/docs/advanced/response-headers.md

    ```Python hl_lines="10-12"
    {!../../../docs_src/response_headers/tutorial001.py!}
    ```
    
    !!! note "Technical Details"
        You could also use `from starlette.responses import Response` or `from starlette.responses import JSONResponse`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 2.2K bytes
    - Viewed (0)
  5. docs/zh/docs/advanced/response-cookies.md

    ## 直接响应 `Response`
    
    你还可以在直接响应`Response`时直接创建cookies。
    
    你可以参考[Return a Response Directly](response-directly.md){.internal-link target=_blank}来创建response
    
    然后设置Cookies,并返回:
    
    ```Python hl_lines="10-12"
    {!../../../docs_src/response_cookies/tutorial001.py!}
    ```
    
    !!! tip
        需要注意,如果你直接反馈一个response对象,而不是使用`Response`入参,FastAPI则会直接反馈你封装的response对象。
    
        所以你需要确保你响应数据类型的正确性,如:你可以使用`JSONResponse`来兼容JSON的场景。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Aug 18 16:09:38 GMT 2022
    - 2.1K bytes
    - Viewed (0)
  6. docs/zh/docs/advanced/response-headers.md

    你也可以在直接返回`Response`时添加头部。
    
    按照[直接返回响应](response-directly.md){.internal-link target=_blank}中所述创建响应,并将头部作为附加参数传递:
    ```Python hl_lines="10-12"
    {!../../../docs_src/response_headers/tutorial001.py!}
    ```
    
    
    !!! note "技术细节"
        你也可以使用`from starlette.responses import Response`或`from starlette.responses import JSONResponse`。
    
        **FastAPI**提供了与`fastapi.responses`相同的`starlette.responses`,只是为了方便开发者。但是,大多数可用的响应都直接来自Starlette。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 2K bytes
    - Viewed (0)
  7. tests/test_response_class_no_mediatype.py

        response_class=Response,
        responses={500: {"description": "Error", "model": JsonApiError}},
    )
    async def a():
        pass  # pragma: no cover
    
    
    @app.get("/b", responses={500: {"description": "Error", "model": Error}})
    async def b():
        pass  # pragma: no cover
    
    
    client = TestClient(app)
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.3K bytes
    - Viewed (0)
  8. tests/test_response_model_invalid.py

            def read_root():
                pass  # pragma: nocover
    
    
    def test_invalid_response_model_in_responses_raises():
        with pytest.raises(FastAPIError):
            app = FastAPI()
    
            @app.get("/", responses={"500": {"model": NonPydanticModel}})
            def read_root():
                pass  # pragma: nocover
    
    
    def test_invalid_response_model_sub_type_in_responses_raises():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 29 13:04:35 GMT 2020
    - 1.1K bytes
    - Viewed (0)
  9. docs/em/docs/advanced/response-headers.md

    👆 💪 📣 `Response` 🔢 🔗, & ⚒ 🎚 (& 🍪) 👫.
    
    ## 📨 `Response` 🔗
    
    👆 💪 🚮 🎚 🕐❔ 👆 📨 `Response` 🔗.
    
    ✍ 📨 🔬 [📨 📨 🔗](response-directly.md){.internal-link target=_blank} & 🚶‍♀️ 🎚 🌖 🔢:
    
    ```Python hl_lines="10-12"
    {!../../../docs_src/response_headers/tutorial001.py!}
    ```
    
    !!! note "📡 ℹ"
        👆 💪 ⚙️ `from starlette.responses import Response` ⚖️ `from starlette.responses import JSONResponse`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 1.9K bytes
    - Viewed (0)
  10. docs/en/docs/advanced/custom-response.md

        **FastAPI** provides the same `starlette.responses` as `fastapi.responses` just as a convenience for you, the developer. But most of the available responses come directly from Starlette.
    
    ### `Response`
    
    The main `Response` class, all the other responses inherit from it.
    
    You can return it directly.
    
    It accepts the following parameters:
    
    * `content` - A `str` or `bytes`.
    * `status_code` - An `int` HTTP status code.
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.7K bytes
    - Viewed (0)
Back to top