Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 161 for Headers (0.27 sec)

  1. tests/test_repeated_cookie_headers.py

    client = TestClient(app)
    
    
    def test_cookie_is_set_once():
        direct_response = client.get("/directCookie")
        indirect_response = client.get("/indirectCookie")
        assert (
            direct_response.headers["set-cookie"] == indirect_response.headers["set-cookie"]
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Jun 13 12:44:51 GMT 2020
    - 792 bytes
    - Viewed (0)
  2. tests/test_tutorial/test_security/test_tutorial005_an.py

        response = client.get("/users/me", headers={"Authorization": "Bearer nonexistent"})
        assert response.status_code == 401, response.text
        assert response.json() == {"detail": "Could not validate credentials"}
        assert response.headers["WWW-Authenticate"] == 'Bearer scope="me"'
    
    
    def test_incorrect_token_type():
        response = client.get(
            "/users/me", headers={"Authorization": "Notexistent testtoken"}
        )
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 15.4K bytes
    - Viewed (0)
  3. docs_src/app_testing/app_b_an/test_main.py

    
    def test_read_nonexistent_item():
        response = client.get("/items/baz", headers={"X-Token": "coneofsilence"})
        assert response.status_code == 404
        assert response.json() == {"detail": "Item not found"}
    
    
    def test_create_item():
        response = client.post(
            "/items/",
            headers={"X-Token": "coneofsilence"},
    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)
  4. tests/test_tutorial/test_dependencies/test_tutorial012_an.py

    
    def test_get_invalid_second_header_items():
        response = client.get(
            "/items/", headers={"X-Token": "fake-super-secret-token", "X-Key": "invalid"}
        )
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "X-Key header invalid"}
    
    
    def test_get_invalid_second_header_users():
        response = client.get(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_security/test_tutorial001_an.py

        assert response.headers["WWW-Authenticate"] == "Bearer"
    
    
    def test_token():
        response = client.get("/items", headers={"Authorization": "Bearer testtoken"})
        assert response.status_code == 200, response.text
        assert response.json() == {"token": "testtoken"}
    
    
    def test_incorrect_token():
        response = client.get("/items", headers={"Authorization": "Notexistent testtoken"})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.9K bytes
    - Viewed (0)
  6. fastapi/security/http.py

                        detail="Not authenticated",
                        headers=unauthorized_headers,
                    )
                else:
                    return None
            invalid_user_credentials_exc = HTTPException(
                status_code=HTTP_401_UNAUTHORIZED,
                detail="Invalid authentication credentials",
                headers=unauthorized_headers,
            )
            try:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Apr 19 15:29:38 GMT 2024
    - 13.2K bytes
    - Viewed (0)
  7. docs_src/custom_request_and_route/tutorial003.py

                duration = time.time() - before
                response.headers["X-Response-Time"] = str(duration)
                print(f"route duration: {duration}")
                print(f"route response: {response}")
                print(f"route response headers: {response.headers}")
                return response
    
            return custom_route_handler
    
    
    app = FastAPI()
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 1K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_header_params/test_tutorial003.py

                200,
                {"X-Token values": ["foo", "bar"]},
            ),
        ],
    )
    def test(path, headers, expected_status, expected_response):
        response = client.get(path, headers=headers)
        assert response.status_code == expected_status
        assert response.json() == expected_response
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 12 14:52:00 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_header_params/test_tutorial001_an_py310.py

        ],
    )
    def test(path, headers, expected_status, expected_response, client: TestClient):
        response = client.get(path, headers=headers)
        assert response.status_code == expected_status
        assert response.json() == expected_response
    
    
    @needs_py310
    def test_openapi_schema(client: TestClient):
        response = client.get("/openapi.json")
        assert response.status_code == 200
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_header_params/test_tutorial002_an.py

            ),
            (
                "/items",
                {"strange-header": "Not really underscore"},
                200,
                {"strange_header": None},
            ),
        ],
    )
    def test(path, headers, expected_status, expected_response):
        response = client.get(path, headers=headers)
        assert response.status_code == expected_status
        assert response.json() == expected_response
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4K bytes
    - Viewed (0)
Back to top