def test_localhost_cors_middleware_missing_origin(app):
    """Test behavior when Origin header is missing."""
    app.add_middleware(LocalhostCORSMiddleware)
    client = TestClient(app)

    # Test without Origin header
    response = client.get('/test')
    assert response.status_code == 200
    # There should be no access-control-allow-origin header
    assert 'access-control-allow-origin' not in response.headers
Test behavior when Origin header is missing.
tests/unit/test_middleware.py