Search Options

Results per page
Sort
Preferred Languages
Advance

Results 71 - 80 of 802 for json (0.13 sec)

  1. docs/ja/docs/tutorial/handling-errors.md

    ```JSON
    {
      "item": "The Foo Wrestlers"
    }
    ```
    
    しかし、クライアントが`http://example.com/items/bar`(存在しない`item_id` `"bar"`)をリクエストした場合、HTTPステータスコード404("not found"エラー)と以下のJSONレスポンスが返されます:
    
    ```JSON
    {
      "detail": "Item not found"
    }
    ```
    
    !!! tip "豆知識"
        `HTTPException`を発生させる際には、`str`だけでなく、JSONに変換できる任意の値を`detail`パラメータとして渡すことができます。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 11.8K bytes
    - Viewed (0)
  2. tests/test_compat.py

            return foo
    
        client = TestClient(app)
    
        response = client.post("/", json="bar")
        assert response.status_code == 200, response.text
        assert response.json() == "bar"
    
        response2 = client.post("/", json=[1, 2])
        assert response2.status_code == 200, response2.text
        assert response2.json() == [1, 2]
    
    
    def test_is_bytes_sequence_annotation_union():
        # For coverage
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  3. docs/en/docs/advanced/generate-clients.md

    Now as the end result is in a file `openapi.json`, you would modify the `package.json` to use that local file, for example:
    
    ```JSON  hl_lines="7"
    {
      "name": "frontend-app",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "generate-client": "openapi-ts --input ./openapi.json --output ./src/client --client axios"
      },
      "author": "",
      "license": "",
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 10.5K bytes
    - Viewed (0)
  4. docs/de/docs/advanced/openapi-callbacks.md

    ```
    https://www.external.org/events/invoices/2expen51ve
    ```
    
    mit einem JSON-Body, der etwa Folgendes enthält:
    
    ```JSON
    {
        "description": "Payment celebration",
        "paid": true
    }
    ```
    
    und sie würde eine Response von dieser *externen API* mit einem JSON-Body wie dem folgenden erwarten:
    
    ```JSON
    {
        "ok": true
    }
    ```
    
    !!! tip "Tipp"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 20:17:23 GMT 2024
    - 8.8K bytes
    - Viewed (0)
  5. tests/test_serialize_response.py

    
    def test_valid():
        response = client.get("/items/valid")
        response.raise_for_status()
        assert response.json() == {"name": "valid", "price": 1.0, "owner_ids": None}
    
    
    def test_coerce():
        response = client.get("/items/coerce")
        response.raise_for_status()
        assert response.json() == {"name": "coerce", "price": 1.0, "owner_ids": None}
    
    
    def test_validlist():
        response = client.get("/items/validlist")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Aug 03 12:29:07 GMT 2020
    - 1.4K bytes
    - Viewed (0)
  6. docs_src/dependency_testing/tutorial001_py310.py

        response = client.get("/items/")
        assert response.status_code == 200
        assert response.json() == {
            "message": "Hello Items!",
            "params": {"q": None, "skip": 5, "limit": 10},
        }
    
    
    def test_override_in_items_with_q():
        response = client.get("/items/?q=foo")
        assert response.status_code == 200
        assert response.json() == {
            "message": "Hello Items!",
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1.4K bytes
    - Viewed (0)
  7. docs/de/docs/tutorial/body-nested-models.md

        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="20"
        {!> ../../../docs_src/body_nested_models/tutorial006.py!}
        ```
    
    Das wird einen JSON-Body erwarten (konvertieren, validieren, dokumentieren), wie:
    
    ```JSON hl_lines="11"
    {
        "name": "Foo",
        "description": "The pretender",
        "price": 42.0,
        "tax": 3.2,
        "tags": [
            "rock",
            "metal",
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 10.4K bytes
    - Viewed (0)
  8. docs/ko/docs/tutorial/body.md

    예를 들면, 위의 이 모델은 JSON "`object`" (혹은 파이썬 `dict`)을 다음과 같이 선언합니다:
    
    ```JSON
    {
        "name": "Foo",
        "description": "선택적인 설명란",
        "price": 45.2,
        "tax": 3.5
    }
    ```
    
    ...`description`과 `tax`는 (기본 값이 `None`으로 되어 있어) 선택적이기 때문에, 이 JSON "`object`"는 다음과 같은 상황에서도 유효합니다:
    
    ```JSON
    {
        "name": "Foo",
        "price": 45.2
    }
    ```
    
    ## 매개변수로서 선언하기
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 8.7K bytes
    - Viewed (0)
  9. docs/en/docs/advanced/behind-a-proxy.md

    So, the frontend (that runs in the browser) would try to reach `/openapi.json` and wouldn't be able to get the OpenAPI schema.
    
    Because we have a proxy with a path prefix of `/api/v1` for our app, the frontend needs to fetch the OpenAPI schema at `/api/v1/openapi.json`.
    
    ```mermaid
    graph LR
    
    browser("Browser")
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 02 22:37:31 GMT 2024
    - 11.6K bytes
    - Viewed (2)
  10. docs/zh/docs/advanced/response-directly.md

    # 直接返回响应
    
    当你创建一个 **FastAPI** *路径操作* 时,你可以正常返回以下任意一种数据:`dict`,`list`,Pydantic 模型,数据库模型等等。
    
    **FastAPI** 默认会使用 `jsonable_encoder` 将这些类型的返回值转换成 JSON 格式,`jsonable_encoder` 在 [JSON 兼容编码器](../tutorial/encoder.md){.internal-link target=_blank} 中有阐述。
    
    然后,**FastAPI** 会在后台将这些兼容 JSON 的数据(比如字典)放到一个 `JSONResponse` 中,该 `JSONResponse` 会用来发送响应给客户端。
    
    但是你可以在你的 *路径操作* 中直接返回一个 `JSONResponse`。
    
    直接返回响应可能会有用处,比如返回自定义的响应头和 cookies。
    
    ## 返回 `Response`
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 12 00:06:16 GMT 2022
    - 3.1K bytes
    - Viewed (0)
Back to top