Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 77 for Middleware (0.17 sec)

  1. docs/em/docs/advanced/middleware.md

    ```
    
    โœ‹๏ธ FastAPI (๐Ÿค™ ๐Ÿ’ƒ) ๐Ÿšš ๐Ÿ™… ๐ŸŒŒ โšซ๏ธ ๐Ÿ‘ˆ โš’ ๐Ÿ’ญ ๐Ÿ‘ˆ ๐Ÿ”— ๐Ÿ› ๏ธ ๐Ÿต ๐Ÿ’ฝ โŒ & ๐Ÿ›ƒ โš  ๐Ÿ•โ€๐Ÿฆบ ๐Ÿ‘ท โ˜‘.
    
    ๐Ÿ‘ˆ, ๐Ÿ‘† โš™๏ธ `app.add_middleware()` (๐Ÿ–ผ โšœ).
    
    ```Python
    from fastapi import FastAPI
    from unicorn import UnicornMiddleware
    
    app = FastAPI()
    
    app.add_middleware(UnicornMiddleware, some_config="rainbow")
    ```
    
    `app.add_middleware()` ๐Ÿ“จ ๐Ÿ› ๏ธ ๐ŸŽ“ ๐Ÿฅ‡ โŒ & ๐Ÿ™† ๐ŸŒ– โŒ ๐Ÿšถโ€โ™€๏ธ ๐Ÿ› ๏ธ.
    
    ## ๐Ÿ› ๏ธ ๐Ÿ› ๏ธ
    
    **FastAPI** ๐Ÿ”Œ ๐Ÿ“š ๐Ÿ› ๏ธ โš  โš™๏ธ ๐Ÿ’ผ, ๐Ÿ‘ฅ ๐Ÿ”œ ๐Ÿ‘€ โญ โ” โš™๏ธ ๐Ÿ‘ซ.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 3.3K bytes
    - Viewed (0)
  2. docs/ja/docs/tutorial/middleware.md

    ## ใƒŸใƒ‰ใƒซใ‚ฆใ‚งใ‚ขใฎไฝœๆˆ
    
    ใƒŸใƒ‰ใƒซใ‚ฆใ‚งใ‚ขใ‚’ไฝœๆˆใ™ใ‚‹ใซใฏใ€้–ขๆ•ฐใฎไธŠ้ƒจใงใƒ‡ใ‚ณใƒฌใƒผใ‚ฟ `@app.middleware("http")` ใ‚’ไฝฟ็”จใ—ใพใ™ใ€‚
    
    ใƒŸใƒ‰ใƒซใ‚ฆใ‚งใ‚ข้–ขๆ•ฐใฏไปฅไธ‹ใ‚’ๅ—ใ‘ๅ–ใ‚Šใพใ™:
    
    * `request`ใ€‚
    * ใƒ‘ใƒฉใƒกใƒผใ‚ฟใจใ—ใฆ `request` ใ‚’ๅ—ใ‘ๅ–ใ‚‹้–ขๆ•ฐ `call_next`ใ€‚
        * ใ“ใฎ้–ขๆ•ฐใฏใ€ๅฏพๅฟœใ™ใ‚‹*path operation*ใซ `request` ใ‚’ๆธกใ—ใพใ™ใ€‚
        * ๆฌกใซใ€ๅฏพๅฟœใ™ใ‚‹*path operation*ใซใ‚ˆใฃใฆ็”Ÿๆˆใ•ใ‚ŒใŸ `response` ใ‚’่ฟ”ใ—ใพใ™ใ€‚
    * ใใฎๅพŒใ€`response` ใ‚’่ฟ”ใ™ๅ‰ใซใ•ใ‚‰ใซ `response` ใ‚’ๅค‰ๆ›ดใ™ใ‚‹ใ“ใจใ‚‚ใงใใพใ™ใ€‚
    
    ```Python hl_lines="8-9  11  14"
    {!../../../docs_src/middleware/tutorial001.py!}
    ```
    
    !!! tip "่ฑ†็Ÿฅ่ญ˜"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 12 00:06:16 GMT 2022
    - 3.8K bytes
    - Viewed (0)
  3. docs/em/docs/tutorial/middleware.md

    ## โœ ๐Ÿ› ๏ธ
    
    โœ ๐Ÿ› ๏ธ ๐Ÿ‘† โš™๏ธ ๐Ÿ‘จโ€๐ŸŽจ `@app.middleware("http")` ๐Ÿ”› ๐Ÿ” ๐Ÿ”ข.
    
    ๐Ÿ› ๏ธ ๐Ÿ”ข ๐Ÿ“จ:
    
    *  `request`.
    * ๐Ÿ”ข `call_next` ๐Ÿ‘ˆ ๐Ÿ”œ ๐Ÿ“จ `request` ๐Ÿ”ข.
        * ๐Ÿ‘‰ ๐Ÿ”ข ๐Ÿ”œ ๐Ÿšถโ€โ™€๏ธ `request` ๐Ÿ”— *โžก ๐Ÿ› ๏ธ*.
        * โคด๏ธ โšซ๏ธ ๐Ÿ“จ `response` ๐Ÿ— ๐Ÿ”— *โžก ๐Ÿ› ๏ธ*.
    * ๐Ÿ‘† ๐Ÿ’ช โคด๏ธ ๐Ÿ”€ ๐ŸŒ… `response` โญ ๐Ÿ›ฌ โšซ๏ธ.
    
    ```Python hl_lines="8-9  11  14"
    {!../../../docs_src/middleware/tutorial001.py!}
    ```
    
    !!! tip
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 2.4K bytes
    - Viewed (0)
  4. tests/test_custom_middleware_exception.py

            await self.app(scope, wrapper, send)
    
    
    @router.post("/middleware")
    def run_middleware(file: UploadFile = File(..., description="Big File")):
        return {"message": "OK"}
    
    
    app.include_router(router)
    app.add_middleware(ContentSizeLimitMiddleware, max_content_size=2**8)
    
    
    client = TestClient(app)
    
    
    def test_custom_middleware_exception(tmp_path: Path):
        default_pydantic_max_size = 2**16
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Aug 25 21:44:40 GMT 2022
    - 2.8K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_sql_databases/test_sql_databases_middleware.py

    bebop <******@****.***> 1710356830 -0400
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 16.3K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_sql_databases/test_sql_databases_middleware_py310.py

    bebop <******@****.***> 1710356830 -0400
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 16.5K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_sql_databases/test_sql_databases_middleware_py39.py

    bebop <******@****.***> 1710356830 -0400
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 16.5K bytes
    - Viewed (0)
  8. tests/test_ws_router.py

                pass  # pragma: no cover
        assert e.value.code == status.WS_1000_NORMAL_CLOSURE
    
    
    def websocket_middleware(middleware_func):
        """
        Helper to create a Starlette pure websocket middleware
        """
    
        def middleware_constructor(app):
            @functools.wraps(app)
            async def wrapped_app(scope, receive, send):
                if scope["type"] != "websocket":
    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)
  9. cmd/routers.go

    }
    
    // List of some generic middlewares which are applied for all incoming requests.
    var globalMiddlewares = []mux.MiddlewareFunc{
    	// set x-amz-request-id header and others
    	addCustomHeadersMiddleware,
    	// The generic tracer needs to be the first middleware to catch all requests
    	// returned early by any other middleware (but after the middleware that
    	// sets the amz request id).
    	httpTracerMiddleware,
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Mar 08 19:08:18 GMT 2024
    - 3.6K bytes
    - Viewed (1)
  10. tests/test_dependency_contextvars.py

        contextvar_token = legacy_request_state_context_var.set(request_state)
        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
    
    
    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)
Back to top