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>
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 @@
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))