Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 1,659 for Response (0.22 sec)

  1. docs/es/docs/advanced/response-change-status-code.md

    Pero aún quieres poder filtrar y convertir los datos que retornas con un `response_model`.
    
    Para esos casos, puedes usar un parámetro `Response`.
    
    ## Usar un parámetro `Response`
    
    Puedes declarar un parámetro de tipo `Response` en tu *función de la operación de path* (como puedes hacer para cookies y headers).
    
    Y luego puedes establecer el `status_code` en ese objeto de respuesta *temporal*.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Feb 06 19:56:23 GMT 2024
    - 1.6K bytes
    - Viewed (0)
  2. 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)
  3. 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 Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Mar 01 20:49:20 GMT 2020
    - 5K bytes
    - Viewed (0)
  4. 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 Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 11.1K bytes
    - Viewed (0)
  5. 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 Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  6. 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 Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  7. tests/test_orjson_response_class.py

            response = client.get("/orjson_non_str_keys")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Sep 02 10:17:31 GMT 2022
    - 562 bytes
    - Viewed (0)
  8. cmd/api-response_test.go

    Harshavardhana <******@****.***> 1618774873 -0700
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Apr 23 18:58:53 GMT 2021
    - 3.5K 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 Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Jun 10 20:30:28 GMT 2023
    - 1.4K bytes
    - Viewed (0)
  10. tests/test_validate_response_dataclass.py

        owner_ids: Optional[List[int]] = None
    
    
    @app.get("/items/invalid", response_model=Item)
    def get_invalid():
        return {"name": "invalid", "price": "foo"}
    
    
    @app.get("/items/innerinvalid", response_model=Item)
    def get_innerinvalid():
        return {"name": "double invalid", "price": "foo", "owner_ids": ["foo", "bar"]}
    
    
    @app.get("/items/invalidlist", response_model=List[Item])
    def get_invalidlist():
        return [
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 1.2K bytes
    - Viewed (0)
Back to top