Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for 307 (0.01 sec)

  1. tests/test_tutorial/test_custom_response/test_tutorial006b.py

    from docs_src.custom_response.tutorial006b_py39 import app
    
    client = TestClient(app)
    
    
    def test_redirect_response_class():
        response = client.get("/fastapi", follow_redirects=False)
        assert response.status_code == 307
        assert response.headers["location"] == "https://fastapi.tiangolo.com"
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 904 bytes
    - Viewed (0)
  2. tests/test_tutorial/test_advanced_middleware/test_tutorial001.py

        response = client.get("/")
        assert response.status_code == 200, response.text
    
        client = TestClient(app)
        response = client.get("/", follow_redirects=False)
        assert response.status_code == 307, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 479 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_response_model/test_tutorial003_03.py

    from docs_src.response_model.tutorial003_03_py39 import app
    
    client = TestClient(app)
    
    
    def test_get_portal():
        response = client.get("/teleport", follow_redirects=False)
        assert response.status_code == 307, response.text
        assert response.headers["location"] == "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    
    
    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.1K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_behind_a_proxy/test_tutorial001_01.py

    client = TestClient(
        app,
        base_url="https://example.com",
        follow_redirects=False,
    )
    
    
    def test_redirect() -> None:
        response = client.get("/items")
        assert response.status_code == 307
        assert response.headers["location"] == "https://example.com/items/"
    
    
    def test_no_redirect() -> None:
        response = client.get("/items/")
        assert response.status_code == 200
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 544 bytes
    - Viewed (0)
  5. tests/test_tutorial/test_response_model/test_tutorial003_02.py

    
    def test_get_redirect():
        response = client.get("/portal", params={"teleport": True}, follow_redirects=False)
        assert response.status_code == 307, response.text
        assert response.headers["location"] == "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    
    
    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
    - 3.4K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_custom_response/test_tutorial006.py

    from docs_src.custom_response.tutorial006_py39 import app
    
    client = TestClient(app)
    
    
    def test_get():
        response = client.get("/typer", follow_redirects=False)
        assert response.status_code == 307, response.text
        assert response.headers["location"] == "https://typer.tiangolo.com"
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1K bytes
    - Viewed (0)
  7. tests/test_router_redirect_slashes.py

        response = client.get("/hello/", follow_redirects=False)
        assert response.status_code == 200
    
        response = client.get("/hello", follow_redirects=False)
        assert response.status_code == 307
    
    
    def test_redirect_slashes_disabled():
        app = FastAPI(redirect_slashes=False)
        router = APIRouter()
    
        @router.get("/hello/")
        def hello_page() -> str:
            return "Hello, World!"
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Thu Jun 22 10:37:50 UTC 2023
    - 974 bytes
    - Viewed (0)
  8. tests/test_tutorial/test_response_model/test_tutorial003_05.py

    
    def test_get_redirect(client: TestClient):
        response = client.get("/portal", params={"teleport": True}, follow_redirects=False)
        assert response.status_code == 307, response.text
        assert response.headers["location"] == "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    
    
    def test_openapi_schema(client: TestClient):
        response = client.get("/openapi.json")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 3.8K bytes
    - Viewed (0)
  9. docs/zh/docs/advanced/custom-response.md

    ///
    
    {* ../../docs_src/custom_response/tutorial001.py hl[2,7] *}
    
    /// tip | 小贴士
    
    `ORJSONResponse` 可能是一个更快的选择。
    
    ///
    
    ### `RedirectResponse`
    
    返回 HTTP 重定向。默认情况下使用 307 状态代码(临时重定向)。
    
    {* ../../docs_src/custom_response/tutorial006.py hl[2,9] *}
    
    ### `StreamingResponse`
    
    采用异步生成器或普通生成器/迭代器,然后流式传输响应主体。
    
    {* ../../docs_src/custom_response/tutorial007.py hl[2,14] *}
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 7.5K bytes
    - Viewed (0)
Back to top