Fix api version mismatch return code

According to API-WG guideline, if the requested microversion is not
supported by the API, we should return 406: Not Acceptable instead of
the default 500: Server Error or 400: Bad Request.

Change-Id: I6314e633b74053e8a770388aeb21f1124ac6ab73
This commit is contained in:
tengqm 2016-08-26 00:07:39 -04:00
parent 5353ee2480
commit 3242ea9244
3 changed files with 5 additions and 0 deletions

View File

@ -42,6 +42,9 @@
405:
default: |
Method is not valid for this endpoint.
406:
default: |
The requested API version is not supported by the API.
409:
default: |
This operation conflicted with another operation on this resource.

View File

@ -59,6 +59,7 @@ Response Codes
.. rest_status_code:: error status.yaml
- 404
- 406
- 503
Response Parameters

View File

@ -52,6 +52,7 @@ class FaultWrapper(wsgi.Middleware):
'FeatureNotSupported': webob.exc.HTTPConflict,
'Forbidden': webob.exc.HTTPForbidden,
'InternalError': webob.exc.HTTPInternalServerError,
'InvalidGlobalAPIVersion': webob.exc.HTTPNotAcceptable,
'InvalidParameter': webob.exc.HTTPBadRequest,
'InvalidSchemaError': webob.exc.HTTPBadRequest,
'MethodVersionNotFound': webob.exc.HTTPBadRequest,