- Sort Score
- Num 10 results
- Language All
Results 51 - 60 of 95 for middleware (0.1 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
fastapi/middleware/httpsredirect.py
from starlette.middleware.httpsredirect import ( # noqa HTTPSRedirectMiddleware as HTTPSRedirectMiddleware,
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Dec 20 18:50:00 GMT 2020 - 115 bytes - Click Count (0) -
docs_src/advanced_middleware/tutorial003_py310.py
from fastapi import FastAPI from fastapi.middleware.gzip import GZipMiddleware app = FastAPI() app.add_middleware(GZipMiddleware, minimum_size=1000, compresslevel=5) @app.get("/") async def main():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 230 bytes - Click Count (0) -
fastapi/middleware/cors.py
from starlette.middleware.cors import CORSMiddleware as CORSMiddleware # noqa...
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Dec 20 18:50:00 GMT 2020 - 79 bytes - Click Count (0) -
docs_src/cors/tutorial001_py310.py
from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware app = FastAPI() origins = [ "http://localhost.tiangolo.com", "https://localhost.tiangolo.com", "http://localhost", "http://localhost:8080", ] app.add_middleware( CORSMiddleware, allow_origins=origins, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) @app.get("/")
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 459 bytes - Click Count (0) -
docs_src/advanced_middleware/tutorial001_py310.py
from fastapi import FastAPI from fastapi.middleware.httpsredirect import HTTPSRedirectMiddleware app = FastAPI() app.add_middleware(HTTPSRedirectMiddleware) @app.get("/") async def main():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 231 bytes - Click Count (0) -
fastapi/middleware/gzip.py
from starlette.middleware.gzip import GZipMiddleware as GZipMiddleware # noqa...
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Dec 20 18:50:00 GMT 2020 - 79 bytes - Click Count (0) -
fastapi/middleware/wsgi.py
from starlette.middleware.wsgi import ( WSGIMiddleware as WSGIMiddleware,
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 04 11:54:23 GMT 2026 - 107 bytes - Click Count (0) -
docs/uk/docs/advanced/wsgi.md
І змонтуйте його під певним шляхом. {* ../../docs_src/wsgi/tutorial001_py310.py hl[1,3,23] *} /// note | Примітка Раніше рекомендувалося використовувати `WSGIMiddleware` з `fastapi.middleware.wsgi`, але тепер його визнано застарілим. Замість цього радимо використовувати пакет `a2wsgi`. Використання залишається таким самим.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:27:41 GMT 2026 - 2.2K bytes - Click Count (0) -
docs_src/middleware/tutorial001_py310.py
import time from fastapi import FastAPI, Request app = FastAPI() @app.middleware("http") async def add_process_time_header(request: Request, call_next): start_time = time.perf_counter() response = await call_next(request) process_time = time.perf_counter() - start_time response.headers["X-Process-Time"] = str(process_time)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 365 bytes - Click Count (0) -
tests/test_dependency_contextvars.py
request_state = {"user": "deadpond"} 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 responseCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 1.5K bytes - Click Count (0)