summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Kodihalli <dkodihal@in.ibm.com>2017-04-27 06:30:11 -0500
committerDeepak Kodihalli <dkodihal@in.ibm.com>2017-04-27 08:40:38 -0500
commitdb1a21e373bcabe48ced67a5334a1019852b971d (patch)
treeda553ff5c62d5143e76dd9fe75a3ad04b01e36fb
parent7ec0a4f41437e62b96964013bb805825ccc1abff (diff)
downloadphosphor-rest-server-db1a21e373bcabe48ced67a5334a1019852b971d.tar.gz
phosphor-rest-server-db1a21e373bcabe48ced67a5334a1019852b971d.zip
rest_dbus: fix content-type check
Check content-type only for PUT, POST and PATCH. Resolves openbmc/openbmc#1525. Change-Id: I8ddddb344ecec13e1c07a7dba2ccac56c80302f7 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
-rw-r--r--module/obmc/wsgi/apps/rest_dbus.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/module/obmc/wsgi/apps/rest_dbus.py b/module/obmc/wsgi/apps/rest_dbus.py
index b4a6d0f..55d5b44 100644
--- a/module/obmc/wsgi/apps/rest_dbus.py
+++ b/module/obmc/wsgi/apps/rest_dbus.py
@@ -844,7 +844,8 @@ class ContentCheckerPlugin(object):
self.error_str = "Expecting content type '%s', got '%s'"
def __call__(self, *a, **kw):
- if self.expected_type and \
+ if request.method in ['PUT', 'POST', 'PATCH'] and \
+ self.expected_type and \
self.expected_type != request.content_type:
abort(415, self.error_str % (self.expected_type,
request.content_type))
OpenPOWER on IntegriCloud