-
-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass headers parameters as keyword arguments to handler function #788
Comments
I'd personally want the interface to work the same with Flask and aiohttp. I don't yet have a strong enough understanding of the aiohttp internals to offer an informed opinion on how to do this, but unless we do a major revision bump (to change the interface) I'd probably lean towards trying to bring a |
I was thinking about doing this change for flask and aiohttp |
Ok that seems reasonable to me. |
It's possible to retrieve aiohttp request object in your handlers.
And to add a parameter with this name in your handlers, which give you access to all request information, including headers:
|
@Jyhess can you also provide an example for Flask please? |
@patrickppp you can use the
|
Hello, for now we have patched connexion/decorators/parameter.py accordingly. Feels like there is a need for sync oas-generator with connexion behavior. My point is, if there are pre-generated controllers by oas-code-genarator that expects header params as function argument, then it should be passed down into that callable. Rgds, |
I found a way to fix this issue. Replace the
|
Description
For now there's no way to get the headers parameters from aiohttp. We need to do a custom middleware or use the aiohttp-request to get the headers. But in flask we have the global request variable.
My proposal is to pass headers parameters as keyword arguments to handler function on
parameter_to_arg
decorator function.There's an any architectural problem or something like that blocks the implementation of the headers on handler parameters?
Expected behaviour
Headers parameters passed to handler **kwargs
Actual behaviour
The headers parameters are not passed to handler **kwargs
The text was updated successfully, but these errors were encountered: