diff options
Diffstat (limited to 'module/obmc/wsgi/apps')
| -rw-r--r-- | module/obmc/wsgi/apps/rest_dbus.py | 11 | 
1 files changed, 11 insertions, 0 deletions
diff --git a/module/obmc/wsgi/apps/rest_dbus.py b/module/obmc/wsgi/apps/rest_dbus.py index 7ef4afd..e83d933 100644 --- a/module/obmc/wsgi/apps/rest_dbus.py +++ b/module/obmc/wsgi/apps/rest_dbus.py @@ -642,6 +642,11 @@ class JsonApiRequestPlugin(object):              abort(400, self.error_str % request.json)      def apply(self, callback, route): +        content_type = getattr( +            route.get_undecorated_callback(), '_content_type', None) +        if self.json_type != content_type: +            return callback +          verbs = getattr(              route.get_undecorated_callback(), '_verbs', None)          if verbs is None: @@ -664,8 +669,14 @@ class JsonApiRequestTypePlugin(object):      api = 2      error_str = "Expecting request format { 'data': %s }, got '%s'" +    json_type = "application/json"      def apply(self, callback, route): +        content_type = getattr( +            route.get_undecorated_callback(), '_content_type', None) +        if self.json_type != content_type: +            return callback +          request_type = getattr(              route.get_undecorated_callback(), 'request_type', None)          if request_type is None:  | 

