Don't replace the whole app just the wsgi_app backing

Do not replace the entire app when wrapping with middleware. It is
important to maintain all the flask-functionality on the app object
and ensure any/all test client calls go through the entire stack of
app and middleware.

Partial-Bug: #1776504
Change-Id: I928d08e96b4c79807ad8c312ba17359c54b67fa0
This commit is contained in:
Morgan Fainberg 2018-06-22 17:27:36 -07:00
parent 3330c228ad
commit 1e870abd69
2 changed files with 5 additions and 5 deletions

View File

@ -230,7 +230,7 @@ def application_factory(name='public'):
rtr in ALL_API_ROUTERS]):
dispatch_map['/v3/%s' % pfx] = legacy_dispatcher
application = KeystoneDispatcherMiddleware(
app,
app.wsgi_app = KeystoneDispatcherMiddleware(
app.wsgi_app,
dispatch_map)
return application
return app

View File

@ -122,10 +122,10 @@ def setup_app_middleware(app):
# local_conf, this is all a hold-over from paste-ini and pending
# reworking/removal(s)
factory_func = loaded.driver.factory({}, **mw.conf)
app = factory_func(app)
app.wsgi_app = factory_func(app.wsgi_app)
# Apply werkzeug speficic middleware
app = fixers.ProxyFix(app)
app.wsgi_app = fixers.ProxyFix(app.wsgi_app)
return app