Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 467 for json (0.16 sec)

  1. docs_src/app_testing/app_b/test_main.py

        assert response.status_code == 404
        assert response.json() == {"detail": "Item not found"}
    
    
    def test_create_item():
        response = client.post(
            "/items/",
            headers={"X-Token": "coneofsilence"},
            json={"id": "foobar", "title": "Foo Bar", "description": "The Foo Barters"},
        )
        assert response.status_code == 200
        assert response.json() == {
            "id": "foobar",
            "title": "Foo Bar",
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 1.8K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_dataclasses/test_tutorial001.py

    
    def test_post_item():
        response = client.post("/items/", json={"name": "Foo", "price": 3})
        assert response.status_code == 200
        assert response.json() == {
            "name": "Foo",
            "price": 3,
            "description": None,
            "tax": None,
        }
    
    
    def test_post_invalid_item():
        response = client.post("/items/", json={"name": "Foo", "price": "invalid price"})
        assert response.status_code == 422
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 5.2K bytes
    - Viewed (0)
  3. docs/zh/docs/advanced/additional-responses.md

    			- 媒体类型的密钥,例如 `application/json` ,它包含另一个`JSON`对象作为值,该对象包含:
    				- 一个键` schema` ,它的值是来自模型的`JSON Schema`,正确的位置在这里。
    					- **FastAPI**在这里添加了对OpenAPI中另一个地方的全局JSON模式的引用,而不是直接包含它。这样,其他应用程序和客户端可以直接使用这些JSON模式,提供更好的代码生成工具等。
    
    
    **在OpenAPI中为该路径操作生成的响应将是:**
    
    ```json hl_lines="3-12"
    {
        "responses": {
            "404": {
                "description": "Additional Response",
                "content": {
                    "application/json": {
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Jan 09 15:53:39 GMT 2024
    - 8.2K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_body_fields/test_tutorial001_an_py310.py

        response = client.put("/items/5", json={"item": {"name": "Foo", "price": 3.0}})
        assert response.status_code == 200
        assert response.json() == {
            "item_id": 5,
            "item": {"name": "Foo", "price": 3.0, "description": None, "tax": None},
        }
    
    
    @needs_py310
    def test_items_6(client: TestClient):
        response = client.put(
            "/items/6",
            json={
                "item": {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.3K bytes
    - Viewed (0)
  5. tests/test_multi_body_errors.py

        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() == {
            "item": [
                {
                    "name": "Foo",
                    "age": IsOneOf(
                        5,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.6K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_request_forms/test_tutorial001_an.py

                    },
                ]
            }
        )
    
    
    def test_post_body_json(client: TestClient):
        response = client.post("/login/", json={"username": "Foo", "password": "secret"})
        assert response.status_code == 422, response.text
        assert response.json() == IsDict(
            {
                "detail": [
                    {
                        "type": "missing",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.5K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_body_multiple_params/test_tutorial001_an.py

    def test_post_no_body_q_bar(client: TestClient):
        response = client.put("/items/5?q=bar", json=None)
        assert response.status_code == 200
        assert response.json() == {"item_id": 5, "q": "bar"}
    
    
    def test_post_no_body(client: TestClient):
        response = client.put("/items/5", json=None)
        assert response.status_code == 200
        assert response.json() == {"item_id": 5}
    
    
    def test_post_id_foo(client: TestClient):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.5K bytes
    - Viewed (0)
  8. cmd/rebalance-admin.go

    	NumObjects  uint64        `json:"objects"`
    	NumVersions uint64        `json:"versions"`
    	Bytes       uint64        `json:"bytes"`
    	Bucket      string        `json:"bucket"`
    	Object      string        `json:"object"`
    	Elapsed     time.Duration `json:"elapsed"`
    	ETA         time.Duration `json:"eta"`
    }
    
    type rebalancePoolStatus struct {
    	ID       int               `json:"id"`                 // Pool index (zero-based)
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Dec 22 00:56:43 GMT 2023
    - 3.8K bytes
    - Viewed (0)
  9. internal/logger/reqinfo.go

    	BucketName   string           `json:",omitempty"` // Bucket name
    	ObjectName   string           `json:",omitempty"` // Object name
    	VersionID    string           `json:",omitempty"` // corresponding versionID for the object
    	Objects      []ObjectVersion  `json:",omitempty"` // Only set during MultiObject delete handler.
    	Cred         auth.Credentials `json:"-"`
    	Region       string           `json:"-"`
    	Owner        bool             `json:"-"`
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 4.4K bytes
    - Viewed (0)
  10. docs/pt/docs/tutorial/encoder.md

    A função não retorna um grande `str` contendo os dados no formato JSON (como uma string). Mas sim, retorna uma estrutura de dados padrão do Python (por exemplo, um `dict`) com valores e subvalores compatíveis com JSON.
    
    !!! note "Nota"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 1.9K bytes
    - Viewed (0)
Back to top