Merge "Use correct status code with werkzeug exceptions"
This commit is contained in:
commit
05fcec481e
4
releasenotes/notes/http-code-b4e32ad8485ef841.yaml
Normal file
4
releasenotes/notes/http-code-b4e32ad8485ef841.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Returns the correct status code (404) when a URL is not found.
|
@ -167,6 +167,7 @@ def all_exception_handler(message):
|
|||||||
url = flask.url_for(flask.request.endpoint, identity=message.args[0])
|
url = flask.url_for(flask.request.endpoint, identity=message.args[0])
|
||||||
return flask.redirect(url, code=307, Response=flask.Response)
|
return flask.redirect(url, code=307, Response=flask.Response)
|
||||||
|
|
||||||
|
code = getattr(message, 'code', 500)
|
||||||
if (isinstance(message, error.FishyError)
|
if (isinstance(message, error.FishyError)
|
||||||
or isinstance(message, wz_exc.HTTPException)):
|
or isinstance(message, wz_exc.HTTPException)):
|
||||||
app.logger.debug(
|
app.logger.debug(
|
||||||
@ -175,7 +176,7 @@ def all_exception_handler(message):
|
|||||||
app.logger.exception(
|
app.logger.exception(
|
||||||
'Unexpected %s: %s', message.__class__.__name__, message)
|
'Unexpected %s: %s', message.__class__.__name__, message)
|
||||||
|
|
||||||
return flask.render_template('error.json', message=message), 500
|
return flask.render_template('error.json', message=message), code
|
||||||
|
|
||||||
|
|
||||||
@app.route('/redfish/v1/')
|
@app.route('/redfish/v1/')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user