Placement api: set custom json_error_formatter in root

Change decorator for resource based actions in root
handler to wsgi_wrapper.PlacementWsgify

This is a newly introduced wrapper class around webob.dec.wsgify
to set json formatter in case of webob exceptions.

Change-Id: I847345f7f15a46930faf8793baf801beba98d368
Closes-Bug: #1635182
This commit is contained in:
Pushkar Umaranikar 2017-02-13 22:22:24 +00:00
parent a2b85463b4
commit 77133bbf50
2 changed files with 8 additions and 2 deletions

View File

@ -13,13 +13,13 @@
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
import webob
from nova.api.openstack.placement import microversion
from nova.api.openstack.placement import wsgi_wrapper
@webob.dec.wsgify
@wsgi_wrapper.PlacementWsgify
def home(req):
min_version = microversion.min_version_string()
max_version = microversion.max_version_string()

View File

@ -36,6 +36,8 @@ tests:
$.errors.[0].min_version: /^\d+\.\d+$/
response_strings:
- "Unacceptable version header: 0.5"
response_json_paths:
$.errors[0].title: Not Acceptable
- name: latest microversion is 1.4
GET: /
@ -63,6 +65,8 @@ tests:
status: 400
response_strings:
- "invalid version string: pony.horse"
response_json_paths:
$.errors[0].title: Bad Request
- name: bad format multidot raises 400
GET: /
@ -71,6 +75,8 @@ tests:
status: 400
response_strings:
- "invalid version string: 1.2.3"
response_json_paths:
$.errors[0].title: Bad Request
- name: error in application produces microversion headers
desc: we do not want xml