swagger auto-generated flask server headers swagger auto-generated flask server headers flask flask

swagger auto-generated flask server headers


Ok, I figured out..

The problem was NOT with swagger-editor itself but how it generates the flask (Connexion) code.

Connexion request handling docs (url) says:

"Currently, header parameters are not passed to the handler functions as parameters. But they can be accessed through the underlying connexion.request.headers object which aliases the flask.request.headers object."

The solution is to remove all function attributes (related to headers) from the auto-generated controller and pick them from the request object, therefore:

From:

def health_get(X_Forwarded_Host):    ...

To:

def health_get():    forwarded_host = connexion.request.headers['X-Forwarded-Host']

Bye!