Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 63 for status_code (0.05 seconds)

The search processing time has exceeded the limit. The displayed results may be partial.

  1. tests/benchmarks/test_general_performance.py

        status_code, body = _bench_get(benchmark, client, "/async/dict-with-response-model")
        assert status_code == 200
        assert body == b'{"name":"foo","value":123,"dep":42}'
    
    
    def test_async_return_model_without_response_model(
        benchmark, client: TestClient
    ) -> None:
        status_code, body = _bench_get(benchmark, client, "/async/model-no-response-model")
        assert status_code == 200
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Dec 26 20:40:26 GMT 2025
    - 11.1K bytes
    - Click Count (0)
  2. tests/test_dependency_overrides.py

            ),
            ("/router-decorator-depends/", 200, {"in": "router-decorator-depends"}),
        ],
    )
    def test_override_simple(url, status_code, expected):
        app.dependency_overrides[common_parameters] = overrider_dependency_simple
        response = client.get(url)
        assert response.status_code == status_code
        assert response.json() == expected
        app.dependency_overrides = {}
    
    
    def test_override_with_sub_main_depends():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 11.2K bytes
    - Click Count (0)
  3. tests/test_openapi_separate_input_output_schemas.py

        client_no = get_app_client(separate_input_output_schemas=False)
        response = client.post("/items/", json={"name": "Plumbus"})
        response2 = client_no.post("/items/", json={"name": "Plumbus"})
        assert response.status_code == response2.status_code == 200, response.text
        assert (
            response.json()
            == response2.json()
            == {"name": "Plumbus", "description": None, "sub": None}
        )
    
    
    def test_create_item_with_sub():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 27.8K bytes
    - Click Count (0)
  4. docs/en/docs/advanced/custom-response.md

    If you do that, then you can return the URL directly from your *path operation* function.
    
    In this case, the `status_code` used will be the default one for the `RedirectResponse`, which is `307`.
    
    ---
    
    You can also use the `status_code` parameter combined with the `response_class` parameter:
    
    {* ../../docs_src/custom_response/tutorial006c_py310.py hl[2,7,9] *}
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 11K bytes
    - Click Count (0)
  5. docs/zh-hant/docs/advanced/custom-response.md

    ---
    
    或者你可以在 `response_class` 參數中使用它:
    
    {* ../../docs_src/custom_response/tutorial006b_py310.py hl[2,7,9] *}
    
    若這麼做,你就可以在「路徑操作函式」中直接回傳 URL。
    
    在此情況下,所使用的 `status_code` 會是 `RedirectResponse` 的預設值 `307`。
    
    ---
    
    你也可以同時搭配 `status_code` 與 `response_class` 參數:
    
    {* ../../docs_src/custom_response/tutorial006c_py310.py hl[2,7,9] *}
    
    ### `StreamingResponse` { #streamingresponse }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 10.3K bytes
    - Click Count (0)
  6. fastapi/security/http.py

            return {"WWW-Authenticate": f"{self.model.scheme.title()}"}
    
        def make_not_authenticated_error(self) -> HTTPException:
            return HTTPException(
                status_code=HTTP_401_UNAUTHORIZED,
                detail="Not authenticated",
                headers=self.make_authenticate_headers(),
            )
    
        async def __call__(self, request: Request) -> HTTPAuthorizationCredentials | None:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Mon Mar 16 10:16:48 GMT 2026
    - 13.1K bytes
    - Click Count (0)
  7. docs/ja/docs/advanced/additional-responses.md

    ただし、メディアタイプが `None` のカスタムレスポンスクラスを指定している場合、モデルが関連付けられた追加レスポンスには FastAPI は `application/json` を使用します。
    
    ///
    
    ## 情報の結合 { #combining-information }
    
    `response_model`、`status_code`、`responses` パラメータなど、複数の場所からのレスポンス情報を組み合わせることもできます。
    
    `response_model` を宣言し、デフォルトのステータスコード `200`(必要なら任意のコード)を使い、その同じレスポンスに対する追加情報を `responses` で OpenAPI スキーマに直接記述できます。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 10K bytes
    - Click Count (0)
  8. fastapi/security/oauth2.py

            ones in FastAPI (based on bearer tokens), you might want to override this.
    
            Ref: https://datatracker.ietf.org/doc/html/rfc6749
            """
            return HTTPException(
                status_code=HTTP_401_UNAUTHORIZED,
                detail="Not authenticated",
                headers={"WWW-Authenticate": "Bearer"},
            )
    
        async def __call__(self, request: Request) -> str | None:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Mar 24 16:32:10 GMT 2026
    - 23.6K bytes
    - Click Count (0)
  9. tests/test_request_params/test_form/test_optional_list.py

        response = client.post(path)
        assert response.status_code == 200, response.text
        assert response.json() == {"p": None}
    
    
    @pytest.mark.parametrize(
        "path",
        ["/optional-list-str", "/model-optional-list-str"],
    )
    def test_optional_list_str(path: str):
        client = TestClient(app)
        response = client.post(path, data={"p": ["hello", "world"]})
        assert response.status_code == 200
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 9.9K bytes
    - Click Count (0)
  10. tests/test_schema_extra_examples.py

        response = client.get("/query_example_examples/")
        assert response.status_code == 200, response.text
        response = client.get("/header_example/")
        assert response.status_code == 200, response.text
        response = client.get("/header_examples/")
        assert response.status_code == 200, response.text
        response = client.get("/header_example_examples/")
        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
    - 34.7K bytes
    - Click Count (0)
Back to Top