Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 72 for middleware (0.1 sec)

  1. docs_src/advanced_middleware/tutorial001.py

    from fastapi import FastAPI
    from fastapi.middleware.httpsredirect import HTTPSRedirectMiddleware
    
    app = FastAPI()
    
    app.add_middleware(HTTPSRedirectMiddleware)
    
    
    @app.get("/")
    async def main():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 231 bytes
    - Viewed (0)
  2. docs/de/docs/how-to/custom-request-and-route.md

    In einigen Fällen möchten Sie möglicherweise die von den Klassen `Request` und `APIRoute` verwendete Logik überschreiben.
    
    Das kann insbesondere eine gute Alternative zur Logik in einer Middleware sein.
    
    Wenn Sie beispielsweise den Requestbody lesen oder manipulieren möchten, bevor er von Ihrer Anwendung verarbeitet wird.
    
    /// danger | "Gefahr"
    
    Dies ist eine „fortgeschrittene“ Funktion.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  3. docs_src/middleware/tutorial001.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)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Aug 06 13:46:39 UTC 2024
    - 365 bytes
    - Viewed (0)
  4. tests/test_dependency_contextmanager.py

            state["sync_bg"] = (
                f"sync_bg set - b: {state['context_b']} - a: {state['context_a']}"
            )
    
        tasks.add_task(bg, state)
        return state
    
    
    @app.middleware("http")
    async def middleware(request, call_next):
        response: StreamingResponse = await call_next(request)
        response.headers["x-state"] = json.dumps(state.copy())
        return response
    
    
    client = TestClient(app)
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Aug 17 04:13:50 UTC 2024
    - 11.6K bytes
    - Viewed (0)
  5. docs/pt/docs/advanced/response-headers.md

    você precisa adicioná-los às suas configurações de CORS (saiba mais em [CORS (Cross-Origin Resource Sharing)](../tutorial/cors.md){.internal-link target=_blank}), usando o parâmetro `expose_headers` descrito na <a href="https://www.starlette.io/middleware/#corsmiddleware" class="external-link" target="_blank">documentação de CORS do Starlette</a>....
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 16 07:44:45 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  6. docs/en/mkdocs.yml

          - tutorial/security/index.md
          - tutorial/security/first-steps.md
          - tutorial/security/get-current-user.md
          - tutorial/security/simple-oauth2.md
          - tutorial/security/oauth2-jwt.md
        - tutorial/middleware.md
        - tutorial/cors.md
        - tutorial/sql-databases.md
        - tutorial/bigger-applications.md
        - tutorial/background-tasks.md
        - tutorial/metadata.md
        - tutorial/static-files.md
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Oct 22 20:28:02 UTC 2024
    - 10.4K bytes
    - Viewed (0)
  7. docs/en/docs/how-to/custom-request-and-route.md

    # Custom Request and APIRoute class
    
    In some cases, you may want to override the logic used by the `Request` and `APIRoute` classes.
    
    In particular, this may be a good alternative to logic in a middleware.
    
    For example, if you want to read or manipulate the request body before it is processed by your application.
    
    /// danger
    
    This is an "advanced" feature.
    
    If you are just starting with **FastAPI** you might want to skip this section.
    
    ///
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 22:39:38 UTC 2024
    - 4.3K bytes
    - Viewed (0)
  8. docs/de/docs/advanced/response-headers.md

    CORS-Konfigurationen hinzufügen (weitere Informationen finden Sie unter [CORS (Cross-Origin Resource Sharing)](../tutorial/cors.md){.internal-link target=_blank}), unter Verwendung des Parameters `expose_headers`, dokumentiert in <a href="https://www.starlette.io/middleware/#corsmiddleware" class="external-link" target="_blank">Starlettes CORS-Dokumentation</a>....
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  9. docs/en/docs/advanced/response-headers.md

    see, you need to add them to your CORS configurations (read more in [CORS (Cross-Origin Resource Sharing)](../tutorial/cors.md){.internal-link target=_blank}), using the parameter `expose_headers` documented in <a href="https://www.starlette.io/middleware/#corsmiddleware" class="external-link" target="_blank">Starlette's CORS docs</a>....
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  10. docs/em/docs/advanced/response-headers.md

    class="external-link" target="_blank">⚙️ '✖-' 🔡</a>.
    
    ✋️ 🚥 👆 ✔️ 🛃 🎚 👈 👆 💚 👩‍💻 🖥 💪 👀, 👆 💪 🚮 👫 👆 ⚜ 📳 (✍ 🌅 [⚜ (✖️-🇨🇳 ℹ 🤝)](../tutorial/cors.md){.internal-link target=_blank}), ⚙️ 🔢 `expose_headers` 📄 <a href="https://www.starlette.io/middleware/#corsmiddleware" class="external-link" target="_blank">💃 ⚜ 🩺</a>....
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 1.8K bytes
    - Viewed (0)
Back to top