- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 87 for status_code (0.4 seconds)
-
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) -
fastapi/openapi/utils.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 25.6K bytes - Click Count (0) -
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) -
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) -
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) -
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) -
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) -
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) -
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) -
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)