Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 56 for Bustos (0.18 sec)

  1. tests/test_dependency_contextvars.py

        yield request_state
        legacy_request_state_context_var.reset(contextvar_token)
    
    
    @app.middleware("http")
    async def custom_middleware(
        request: Request, call_next: Callable[[Request], Awaitable[Response]]
    ):
        response = await call_next(request)
        response.headers["custom"] = "foo"
        return response
    
    
    @app.get("/user", dependencies=[Depends(set_up_request_state_dependency)])
    def get_user():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Feb 17 12:40:12 GMT 2022
    - 1.5K bytes
    - Viewed (0)
  2. tests/test_ws_router.py

    
    def test_depend_err_handler():
        """
        Verify that it is possible to write custom WebSocket middleware to catch errors
        """
    
        async def custom_handler(websocket: WebSocket, exc: CustomError) -> None:
            await websocket.close(1002, "foo")
    
        myapp = make_app(exception_handlers={CustomError: custom_handler})
        client = TestClient(myapp)
        with pytest.raises(WebSocketDisconnect) as e:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Jun 11 19:08:14 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  3. docs_src/custom_request_and_route/tutorial002.py

    from fastapi.routing import APIRoute
    
    
    class ValidationErrorLoggingRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                try:
                    return await original_route_handler(request)
                except RequestValidationError as exc:
                    body = await request.body()
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 932 bytes
    - Viewed (0)
  4. tests/test_additional_responses_custom_validationerror.py

    Sebastián Ramírez <******@****.***> 1688149516 +0200
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.9K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_custom_response/test_tutorial006c.py

    from fastapi.testclient import TestClient
    
    from docs_src.custom_response.tutorial006c import app
    
    client = TestClient(app)
    
    
    def test_redirect_status_code():
        response = client.get("/pydantic", follow_redirects=False)
        assert response.status_code == 302
        assert response.headers["location"] == "https://docs.pydantic.dev/"
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 899 bytes
    - Viewed (0)
  6. tests/test_tutorial/test_custom_response/test_tutorial006b.py

    from fastapi.testclient import TestClient
    
    from docs_src.custom_response.tutorial006b import app
    
    client = TestClient(app)
    
    
    def test_redirect_response_class():
        response = client.get("/fastapi", follow_redirects=False)
        assert response.status_code == 307
        assert response.headers["location"] == "https://fastapi.tiangolo.com"
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 899 bytes
    - Viewed (0)
  7. docs_src/custom_docs_ui/tutorial001.py

        get_redoc_html,
        get_swagger_ui_html,
        get_swagger_ui_oauth2_redirect_html,
    )
    
    app = FastAPI(docs_url=None, redoc_url=None)
    
    
    @app.get("/docs", include_in_schema=False)
    async def custom_swagger_ui_html():
        return get_swagger_ui_html(
            openapi_url=app.openapi_url,
            title=app.title + " - Swagger UI",
            oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Oct 30 09:58:58 GMT 2023
    - 1.1K bytes
    - Viewed (0)
  8. docs_src/custom_docs_ui/tutorial002.py

    from fastapi.staticfiles import StaticFiles
    
    app = FastAPI(docs_url=None, redoc_url=None)
    
    app.mount("/static", StaticFiles(directory="static"), name="static")
    
    
    @app.get("/docs", include_in_schema=False)
    async def custom_swagger_ui_html():
        return get_swagger_ui_html(
            openapi_url=app.openapi_url,
            title=app.title + " - Swagger UI",
            oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Aug 19 19:54:04 GMT 2023
    - 1.1K bytes
    - Viewed (0)
  9. tests/test_starlette_exception.py

    @app.get("/items/{item_id}")
    async def read_item(item_id: str):
        if item_id not in items:
            raise HTTPException(
                status_code=404,
                detail="Item not found",
                headers={"X-Error": "Some custom header"},
            )
        return {"item": items[item_id]}
    
    
    @app.get("/http-no-body-statuscode-exception")
    async def no_body_status_code_exception():
        raise HTTPException(status_code=204)
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 7.4K bytes
    - Viewed (0)
  10. tests/test_custom_route_class.py

    Sebastián Ramírez <******@****.***> 1688149516 +0200
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.1K bytes
    - Viewed (0)
Back to top