- Sort Score
- Result 10 results
- Languages All
Results 51 - 60 of 1,430 for responses (0.16 sec)
-
docs/zh/docs/advanced/response-directly.md
直接返回响应可能会有用处,比如返回自定义的响应头和 cookies。 ## 返回 `Response` 事实上,你可以返回任意 `Response` 或者任意 `Response` 的子类。 /// tip | "小贴士" `JSONResponse` 本身是一个 `Response` 的子类。 /// 当你返回一个 `Response` 时,**FastAPI** 会直接传递它。 **FastAPI** 不会用 Pydantic 模型做任何数据转换,不会将响应内容转换成任何类型,等等。 这种特性给你极大的可扩展性。你可以返回任何数据类型,重写任何数据声明或者校验,等等。 ## 在 `Response` 中使用 `jsonable_encoder` 由于 **FastAPI** 并未对你返回的 `Response` 做任何改变,你必须确保你已经准备好响应内容。
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 3.1K bytes - Viewed (0) -
docs/ko/docs/advanced/response-directly.md
예를 들어, 사용자 정의 헤더나 쿠키를 반환해야 하는 경우에 유용할 수 있습니다. ## `Response` 반환하기 사실, `Response` 또는 그 하위 클래스를 반환할 수 있습니다. /// tip `JSONResponse` 자체도 `Response`의 하위 클래스입니다. /// 그리고 `Response`를 반환하면 **FastAPI**가 이를 그대로 전달합니다. Pydantic 모델로 데이터 변환을 수행하지 않으며, 내용을 다른 형식으로 변환하지 않습니다. 이로 인해 많은 유연성을 얻을 수 있습니다. 어떤 데이터 유형이든 반환할 수 있고, 데이터 선언이나 유효성 검사를 재정의할 수 있습니다. ## `Response`에서 `jsonable_encoder` 사용하기
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 30 20:00:57 UTC 2024 - 3.4K bytes - Viewed (0) -
tests/test_tutorial/test_body_updates/test_tutorial001_py39.py
@needs_pydanticv1 def test_openapi_schema_pv1(client: TestClient): 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": { "/items/{item_id}": { "get": { "responses": { "200": {
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Sep 28 04:14:40 UTC 2023 - 11.8K bytes - Viewed (0) -
tests/test_additional_responses_custom_model_in_callback.py
def main_route(callback_url: HttpUrl): pass # pragma: no cover client = TestClient(app) 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": { "/": { "post": {
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 5.8K bytes - Viewed (0) -
docs/en/docs/advanced/additional-status-codes.md
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 27 16:12:23 UTC 2024 - 1.9K bytes - Viewed (0) -
tests/test_computed_fields.py
@app.get("/responses", responses={200: {"model": Rectangle}}) def read_responses() -> Rectangle: return Rectangle(width=3, length=4) client = TestClient(app) return client @pytest.mark.parametrize("path", ["/", "/responses"]) @needs_pydanticv2 def test_get(client: TestClient, path: str): response = client.get(path) assert response.status_code == 200, response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Oct 12 09:44:57 UTC 2024 - 3K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial003.py
response = client.get("/") assert response.status_code == 200, response.text assert b"<form" in response.content 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": { "/files/": {
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 7.1K bytes - Viewed (0) -
docs/de/docs/tutorial/response-status-code.md
* Ein spezieller Fall ist `204`, „No Content“ („Kein Inhalt“). Diese Response wird verwendet, wenn es keinen Inhalt gibt, der zum Client zurückgeschickt wird, diese Response hat also keinen Body. * **`300`** und darüber steht für „Redirection“ („Umleitung“). Responses mit diesen Statuscodes können einen oder keinen Body haben, mit Ausnahme von `304`, „Not Modified“ („Nicht verändert“), welche keinen haben darf.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 27 16:59:43 UTC 2024 - 4.6K bytes - Viewed (0) -
tests/test_response_model_as_return_annotation.py
response = client.get("/response_model-no_annotation-return_same_model") assert response.status_code == 200, response.text assert response.json() == {"name": "John", "surname": "Doe"} def test_response_model_no_annotation_return_exact_dict(): response = client.get("/response_model-no_annotation-return_exact_dict") assert response.status_code == 200, response.text assert response.json() == {"name": "John", "surname": "Doe"}
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon Aug 14 09:49:57 UTC 2023 - 47.7K bytes - Viewed (0) -
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():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 5.3K bytes - Viewed (0)