Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 203 for body (0.16 sec)

  1. tests/test_union_body.py

                                        }
                                    }
                                },
                            },
                        },
                        "summary": "Save Union Body",
                        "operationId": "save_union_body_items__post",
                        "requestBody": {
                            "content": {
                                "application/json": {
                                    "schema": {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.6K bytes
    - Viewed (0)
  2. tests/test_multi_body_errors.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        age: condecimal(gt=Decimal(0.0))  # type: ignore
    
    
    @app.post("/items/")
    def save_item_no_body(item: List[Item]):
        return {"item": item}
    
    
    client = TestClient(app)
    
    
    def test_put_correct_body():
        response = client.post("/items/", json=[{"name": "Foo", "age": 5}])
        assert response.status_code == 200, response.text
        assert response.json() == {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.6K bytes
    - Viewed (0)
  3. tests/test_regex_deprecated_body.py

                                                {
                                                    "$ref": "#/components/schemas/Body_read_items_items__post"
                                                }
                                            ],
                                            "title": "Body",
                                        }
                                    )
                                    | IsDict(
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  4. tests/test_put_no_body.py

    app = FastAPI()
    
    
    @app.put("/items/{item_id}")
    def save_item_no_body(item_id: str):
        return {"item_id": item_id}
    
    
    client = TestClient(app)
    
    
    def test_put_no_body():
        response = client.put("/items/foo")
        assert response.status_code == 200, response.text
        assert response.json() == {"item_id": "foo"}
    
    
    def test_put_no_body_with_body():
        response = client.put("/items/foo", json={"name": "Foo"})
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.3K bytes
    - Viewed (0)
  5. tests/test_union_inherited_body.py

                                    }
                                },
                            },
                        },
                        "summary": "Save Union Different Body",
                        "operationId": "save_union_different_body_items__post",
                        "requestBody": {
                            "content": {
                                "application/json": {
                                    "schema": {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 5.2K bytes
    - Viewed (0)
  6. tests/test_request_body_parameters_media_type.py

    async def create_product(data: Product = Body(media_type=media_type, embed=True)):
        pass  # pragma: no cover
    
    
    @app.post("/shops")
    async def create_shop(
        data: Shop = Body(media_type=media_type),
        included: typing.List[Product] = Body(default=[], media_type=media_type),
    ):
        pass  # pragma: no cover
    
    
    client = TestClient(app)
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 6.4K bytes
    - Viewed (0)
  7. tests/test_response_code_no_body.py

    Sebastián Ramírez <******@****.***> 1688149516 +0200
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.2K bytes
    - Viewed (0)
  8. tests/test_get_request_body.py

    @app.get("/product")
    async def create_item(product: Product):
        return product
    
    
    client = TestClient(app)
    
    
    def test_get_with_body():
        body = {"name": "Foo", "description": "Some description", "price": 5.5}
        response = client.request("GET", "/product", json=body)
        assert response.json() == body
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.7K bytes
    - Viewed (0)
  9. tests/test_params_repr.py

    
    def test_body_repr_str():
        assert repr(Body("teststr")) == "Body(teststr)"
    
    
    def test_body_repr_none():
        assert repr(Body(None)) == "Body(None)"
    
    
    def test_body_repr_ellipsis():
        assert repr(Body(...)) == IsOneOf(
            "Body(PydanticUndefined)",
            # TODO: remove when deprecating Pydantic v1
            "Body(Ellipsis)",
        )
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3.3K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_request_forms_and_files/test_tutorial001_an.py

        client = TestClient(app)
        return client
    
    
    def test_post_form_no_body(client: TestClient):
        response = client.post("/files/")
        assert response.status_code == 422, response.text
        assert response.json() == IsDict(
            {
                "detail": [
                    {
                        "type": "missing",
                        "loc": ["body", "file"],
                        "msg": "Field required",
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 9.8K bytes
    - Viewed (0)
Back to top