pyeve / eve-swagger

Swagger extension for Eve-powered RESTful APIs
http://python-eve.org
Other
154 stars 43 forks source link

fix wrong schemes override checking #56

Closed cuonglm closed 6 years ago

cuonglm commented 6 years ago

Override schemes in SWAGGER_INFO does not work, because the schemes() function is checking it wrongly:

def schemes():
    cfg = app.config[eve_swagger.INFO]
    if hasattr(cfg, 'schemes'):
        return cfg['schemes']

    scheme = request.url.split(':')[0]
return [scheme] if scheme in ['http', 'https', 'ws', 'wss'] else None

cfg is a dict, it has no attribute schemes.

This PR fixes the issue by checking the schemes key actually exists.

cuonglm commented 6 years ago

cc @nicolaiarocci

nicolaiarocci commented 6 years ago

Thanks for this and sorry it took so long to get back to you!