class safir.middleware.ivoa.CaseInsensitiveQueryMiddleware(app)

Bases: object

Make query parameter keys all lowercase.

Unfortunately, several IVOA standards require that query parameters be case-insensitive, which is not supported by modern HTTP web frameworks. This middleware attempts to work around this by lowercasing the query parameter keys before the request is processed, allowing normal FastAPI query parsing to then work without regard for case. This, in turn, permits FastAPI to perform input validation on GET parameters, which would otherwise only happen if the case used in the request happened to match the case used in the function signature.

This unfortunately doesn’t handle POST, so routes that accept POST will need to parse the POST data case-insensitively in the handler or a dependency.

Based on fastapi#826.


app (Callable[[MutableMapping[str, Any], Callable[[], Awaitable[MutableMapping[str, Any]]], Callable[[MutableMapping[str, Any]], Awaitable[None]]], Awaitable[None]])

Methods Summary

__call__(scope, receive, send)

Call self as a function.

Methods Documentation

async __call__(scope, receive, send)

Call self as a function.

Return type: