-
Notifications
You must be signed in to change notification settings - Fork 102
Description
Hi, great work on slowapi.
I saw on your README.md about your limitation of requiring request: Request to be defined in the end user's endpoint function definition.
In my work with the (as of now: unpublished) fastapi-shield library, I mangled the signature of the endpoint function and set it as the __signature__ attribute of the wrapper which is returned to app.[get, post, ...]. This helps with leveraging on FastAPI's dependency injection mechanism to inject Request object into kwargs of endpoint without having the object as part of end user's endpoint function definition. (It is okay if end user also defines a parameter, e.g. req: Request).
By the way, you might also want to not check (ref: codes) that the parameter with type annotated as Request is named as request, checking that it is annotated as Request is sufficient.
Cheers!