from fastapi.testclient import TestClient from app.main import app client = TestClient(app) def test_case_sensitive_headers_preserves_case(): response = client.get( "/ping", headers={"X-Custom-Header": "value", "User-Agent": "test"}, ) assert response.status_code == 200 def test_case_sensitive_headers_no_raw_headers(): response = client.get("/ping", headers={}) assert response.status_code == 200 def test_case_sensitive_headers_post_with_content_type(): response = client.post( "/api/v1/visit", json={"url": "https://example.com"}, headers={"X-Custom-Header": "value", "Content-Type": "application/json"}, ) assert response.status_code in (200, 422) def test_valid_headers_filtering(): response = client.get( "/api/v1/ping", headers={"User-Agent": "test"}, ) assert response.status_code == 200