Search Options

Results per page
Sort
Preferred Languages
Advance

Results 151 - 160 of 1,675 for Responses (0.66 sec)

  1. tests/test_tutorial/test_security/test_tutorial005.py

        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "Incorrect username or password"}
    
    
    def test_no_token(mod: ModuleType):
        client = TestClient(mod.app)
        response = client.get("/users/me")
        assert response.status_code == 401, response.text
        assert response.json() == {"detail": "Not authenticated"}
        assert response.headers["WWW-Authenticate"] == "Bearer"
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 15.8K bytes
    - Viewed (0)
  2. docs_src/response_model/tutorial003_04_py39.py

    from typing import Union
    
    from fastapi import FastAPI, Response
    from fastapi.responses import RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/portal")
    async def get_portal(teleport: bool = False) -> Union[Response, dict]:
        if teleport:
            return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 384 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_custom_response/test_tutorial006c.py

    client = TestClient(app)
    
    
    def test_redirect_status_code():
        response = client.get("/pydantic", follow_redirects=False)
        assert response.status_code == 302
        assert response.headers["location"] == "https://docs.pydantic.dev/"
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 904 bytes
    - Viewed (0)
  4. tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial005.py

    client = TestClient(app)
    
    
    def test_get():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
            "info": {"title": "FastAPI", "version": "0.1.0"},
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1K bytes
    - Viewed (0)
  5. docs/zh/docs/tutorial/handling-errors.md

    {"message": "Oops! yolo did something. There goes a rainbow..."}
    
    ```
    
    /// note | 技术细节
    
    `from starlette.requests import Request` 和 `from starlette.responses import JSONResponse` 也可以用于导入 `Request` 和 `JSONResponse`。
    
    **FastAPI** 提供了与 `starlette.responses` 相同的 `fastapi.responses` 作为快捷方式,但大部分响应操作都可以直接从 Starlette 导入。同理,`Request` 也是如此。
    
    ///
    
    ## 覆盖默认异常处理器
    
    **FastAPI** 自带了一些默认异常处理器。
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Oct 11 17:48:49 UTC 2025
    - 8.2K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_advanced_middleware/test_tutorial003.py

        assert response.headers["Content-Encoding"] == "gzip"
        assert int(response.headers["Content-Length"]) < 4000
        response = client.get("/")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 670 bytes
    - Viewed (0)
  7. tests/test_tutorial/test_testing/test_tutorial001.py

        test_read_main()
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
            "info": {"title": "FastAPI", "version": "0.1.0"},
            "paths": {
                "/": {
                    "get": {
                        "responses": {
                            "200": {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 826 bytes
    - Viewed (0)
  8. docs/de/docs/advanced/middleware.md

    ## `GZipMiddleware` { #gzipmiddleware }
    
    Verarbeitet GZip-Responses für alle Requests, die `"gzip"` im `Accept-Encoding`-Header enthalten.
    
    Diese Middleware verarbeitet sowohl Standard- als auch Streaming-Responses.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 5.1K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_path_operation_configurations/test_tutorial002b.py

    
    def test_get_items():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == ["Portal gun", "Plumbus"]
    
    
    def test_get_users():
        response = client.get("/users/")
        assert response.status_code == 200, response.text
        assert response.json() == ["Rick", "Morty"]
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.7K bytes
    - Viewed (0)
  10. docs_src/response_model/tutorial003_05_py310.py

    from fastapi import FastAPI, Response
    from fastapi.responses import RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/portal", response_model=None)
    async def get_portal(teleport: bool = False) -> Response | dict:
        if teleport:
            return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Jan 10 16:22:47 UTC 2023
    - 373 bytes
    - Viewed (0)
Back to top