Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 859 for Response (0.2 sec)

  1. docs/ja/docs/tutorial/response-status-code.md

    ## 名前を覚えるための近道
    
    先ほどの例をもう一度見てみましょう:
    
    ```Python hl_lines="6"
    {!../../../docs_src/response_status_code/tutorial001.py!}
    ```
    
    `201`は「作成完了」のためのステータスコードです。
    
    しかし、それぞれのコードの意味を暗記する必要はありません。
    
    `fastapi.status`の便利な変数を利用することができます。
    
    ```Python hl_lines="1 6"
    {!../../../docs_src/response_status_code/tutorial002.py!}
    ```
    
    それらは便利です。それらは同じ番号を保持しており、その方法ではエディタの自動補完を使用してそれらを見つけることができます。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Jan 15 15:42:08 GMT 2024
    - 5.6K bytes
    - Viewed (0)
  2. tests/test_response_by_alias.py

        assert response.status_code == 200, response.text
        assert response.json() == {"alias": "Foo"}
    
    
    def test_read_model_by_alias():
        response = client.get("/by-alias/model")
        assert response.status_code == 200, response.text
        assert response.json() == {"alias": "Foo"}
    
    
    def test_read_list_by_alias():
        response = client.get("/by-alias/list")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 11.1K bytes
    - Viewed (0)
  3. tests/test_additional_response_extra.py

    app.include_router(router)
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == {"id": "foo"}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "openapi": "3.1.0",
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  4. docs/em/docs/advanced/response-change-status-code.md

    👆 🎲 ✍ ⏭ 👈 👆 💪 ⚒ 🔢 [📨 👔 📟](../tutorial/response-status-code.md){.internal-link target=_blank}.
    
    ✋️ 💼 👆 💪 📨 🎏 👔 📟 🌘 🔢.
    
    ## ⚙️ 💼
    
    🖼, 🌈 👈 👆 💚 📨 🇺🇸🔍 👔 📟 "👌" `200` 🔢.
    
    ✋️ 🚥 💽 🚫 🔀, 👆 💚 ✍ ⚫️, & 📨 🇺🇸🔍 👔 📟 "✍" `201`.
    
    ✋️ 👆 💚 💪 ⛽ & 🗜 💽 👆 📨 ⏮️ `response_model`.
    
    📚 💼, 👆 💪 ⚙️ `Response` 🔢.
    
    ## ⚙️ `Response` 🔢
    
    👆 💪 📣 🔢 🆎 `Response` 👆 *➡ 🛠️ 🔢* (👆 💪 🍪 & 🎚).
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  5. tests/test_orjson_response_class.py

            response = client.get("/orjson_non_str_keys")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Sep 02 10:17:31 GMT 2022
    - 562 bytes
    - Viewed (0)
  6. tests/test_default_response_class_router.py

            response = client.get("/a")
        assert response.json() == {"msg": "Hello A"}
        assert response.headers["content-type"] == json_type
    
    
    def test_router_a_override():
        with client:
            response = client.get("/a/override")
        assert response.content == b"Hello A"
        assert response.headers["content-type"] == text_type
    
    
    def test_router_a_a():
        with client:
            response = client.get("/a/a")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Mar 01 20:49:20 GMT 2020
    - 5K bytes
    - Viewed (0)
  7. tests/test_serialize_response_model.py

        }
    
    
    client = TestClient(app)
    
    
    def test_valid():
        response = client.get("/items/valid")
        response.raise_for_status()
        assert response.json() == {"aliased_name": "valid", "price": 1.0, "owner_ids": None}
    
    
    def test_coerce():
        response = client.get("/items/coerce")
        response.raise_for_status()
        assert response.json() == {
            "aliased_name": "coerce",
            "price": 1.0,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 4.2K bytes
    - Viewed (0)
  8. tests/test_response_model_invalid.py

            def read_root():
                pass  # pragma: nocover
    
    
    def test_invalid_response_model_in_responses_raises():
        with pytest.raises(FastAPIError):
            app = FastAPI()
    
            @app.get("/", responses={"500": {"model": NonPydanticModel}})
            def read_root():
                pass  # pragma: nocover
    
    
    def test_invalid_response_model_sub_type_in_responses_raises():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Feb 29 13:04:35 GMT 2020
    - 1.1K bytes
    - Viewed (0)
  9. docs/zh/docs/advanced/response-change-status-code.md

    # 响应 - 更改状态码
    
    你可能之前已经了解到,你可以设置默认的[响应状态码](../tutorial/response-status-code.md){.internal-link target=_blank}。
    
    但在某些情况下,你需要返回一个不同于默认值的状态码。
    
    ## 使用场景
    
    例如,假设你想默认返回一个HTTP状态码为“OK”`200`。
    
    但如果数据不存在,你想创建它,并返回一个HTTP状态码为“CREATED”`201`。
    
    但你仍然希望能够使用`response_model`过滤和转换你返回的数据。
    
    对于这些情况,你可以使用一个`Response`参数。
    
    ## 使用 `Response` 参数
    
    你可以在你的*路径操作函数*中声明一个`Response`类型的参数(就像你可以为cookies和头部做的那样)。
    
    然后你可以在这个*临时*响应对象中设置`status_code`。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Jun 10 20:30:28 GMT 2023
    - 1.4K bytes
    - Viewed (0)
  10. tests/test_default_response_class.py

            response = client.get("/a")
        assert response.json() == {"msg": "Hello A"}
        assert response.headers["content-type"] == orjson_type
    
    
    def test_router_a_override():
        with client:
            response = client.get("/a/override")
        assert response.content == b"Hello A"
        assert response.headers["content-type"] == text_type
    
    
    def test_router_a_a():
        with client:
            response = client.get("/a/a")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Mar 01 20:49:20 GMT 2020
    - 5.2K bytes
    - Viewed (0)
Back to top