Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 1 of 1 for test_root_path_does_not_persist_across_requests (0.19 seconds)

  1. tests/test_openapi_cache_root_path.py

    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    
    def test_root_path_does_not_persist_across_requests():
        app = FastAPI()
    
        @app.get("/")
        def read_root():  # pragma: no cover
            return {"ok": True}
    
        # Attacker request with a spoofed root_path
        attacker_client = TestClient(app, root_path="/evil-api")
        response1 = attacker_client.get("/openapi.json")
        data1 = response1.json()
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 24 09:28:10 GMT 2026
    - 2.3K bytes
    - Click Count (0)
Back to Top