Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 159 for expect (0.17 sec)

  1. docs/en/docs/tutorial/body-multiple-params.md

    ## Embed a single body parameter
    
    Let's say you only have a single `item` body parameter from a Pydantic model `Item`.
    
    By default, **FastAPI** will then expect its body directly.
    
    But if you want it to expect a JSON with a key `item` and inside of it the model contents, as it does when you declare extra body parameters, you can use the special `Body` parameter `embed`:
    
    ```Python
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 7.7K bytes
    - Viewed (0)
  2. tests/test_typing_python39.py

        }
        for test_type, expect in types.items():
            app = FastAPI()
    
            @app.post("/", response_model=test_type)
            def post_endpoint(input: test_type):
                return input
    
            res = TestClient(app).post("/", json=expect)
            assert res.status_code == 200, res.json()
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 709 bytes
    - Viewed (0)
  3. docs/en/docs/tutorial/request-forms-and-files.md

    And you can declare some of the files as `bytes` and some as `UploadFile`.
    
    !!! warning
        You can declare multiple `File` and `Form` parameters in a *path operation*, but you can't also declare `Body` fields that you expect to receive as JSON, as the request will have the body encoded using `multipart/form-data` instead of `application/json`.
    
        This is not a limitation of **FastAPI**, it's part of the HTTP protocol.
    
    ## Recap
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:02:19 GMT 2024
    - 2K bytes
    - Viewed (0)
  4. docs/en/docs/advanced/behind-a-proxy.md

    ```JSON
    {
        "message": "Hello World",
        "root_path": "/api/v1"
    }
    ```
    
    So, it won't expect to be accessed at `http://127.0.0.1:8000/api/v1/app`.
    
    Uvicorn will expect the proxy to access Uvicorn at `http://127.0.0.1:8000/app`, and then it would be the proxy's responsibility to add the extra `/api/v1` prefix on top.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.6K bytes
    - Viewed (2)
  5. docs/en/docs/advanced/middleware.md

    A middleware doesn't have to be made for FastAPI or Starlette to work, as long as it follows the ASGI spec.
    
    In general, ASGI middlewares are classes that expect to receive an ASGI app as the first argument.
    
    So, in the documentation for third-party ASGI middlewares they will probably tell you to do something like:
    
    ```Python
    from unicorn import UnicornMiddleware
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 10 18:27:10 GMT 2023
    - 4K bytes
    - Viewed (0)
  6. .github/DISCUSSION_TEMPLATE/questions.yml

            What is the problem, question, or error?
    
            Write a short description telling me what you are doing, what you expect to happen, and what is currently happening.
          placeholder: |
            * Open the browser and call the endpoint `/`.
            * It returns a JSON with `{"Hello": "World"}`.
            * But I expected it to return `{"Hello": "Sara"}`.
        validations:
          required: true
      - type: dropdown
        id: os
        attributes:
    Others
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Aug 03 15:59:41 GMT 2023
    - 5.8K bytes
    - Viewed (1)
  7. docs/en/docs/tutorial/request-forms.md

    !!! warning
        You can declare multiple `Form` parameters in a *path operation*, but you can't also declare `Body` fields that you expect to receive as JSON, as the request will have the body encoded using `application/x-www-form-urlencoded` instead of `application/json`.
    
        This is not a limitation of **FastAPI**, it's part of the HTTP protocol.
    
    ## Recap
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:02:19 GMT 2024
    - 3.2K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/body-nested-models.md

        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="20"
        {!> ../../../docs_src/body_nested_models/tutorial004.py!}
        ```
    
    This would mean that **FastAPI** would expect a body similar to:
    
    ```JSON
    {
        "name": "Foo",
        "description": "The pretender",
        "price": 42.0,
        "tax": 3.2,
        "tags": ["rock", "metal", "bar"],
        "image": {
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.5K bytes
    - Viewed (0)
  9. docs/en/docs/tutorial/request-files.md

    * It exposes an actual Python <a href="https://docs.python.org/3/library/tempfile.html#tempfile.SpooledTemporaryFile" class="external-link" target="_blank">`SpooledTemporaryFile`</a> object that you can pass directly to other libraries that expect a file-like object.
    
    ### `UploadFile`
    
    `UploadFile` has the following attributes:
    
    * `filename`: A `str` with the original file name that was uploaded (e.g. `myimage.jpg`).
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:02:19 GMT 2024
    - 10.2K bytes
    - Viewed (0)
  10. docs/en/docs/advanced/openapi-callbacks.md

    In this case, you could want to document how that external API *should* look like. What *path operation* it should have, what body it should expect, what response it should return, etc.
    
    ## An app with callbacks
    
    Let's see all this with an example.
    
    Imagine you develop an app that allows creating invoices.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 7.7K bytes
    - Viewed (0)
Back to top