diff --git a/auditmiddleware/_api.py b/auditmiddleware/_api.py index d1c8e3e..57c0b77 100644 --- a/auditmiddleware/_api.py +++ b/auditmiddleware/_api.py @@ -381,7 +381,8 @@ def _create_events(self, target_project, res_id, # which contains a list of items res_pl = res_payload[res_spec.type_name] req_pl = None - if self._payloads_enabled and res_spec.payloads['enabled']: + if self._payloads_enabled and res_spec.payloads['enabled'] \ + and request.content_type == 'application/json': req_pl = iter(request.json.get(res_spec.type_name)) # create one event per item @@ -435,7 +436,8 @@ def _create_events(self, target_project, res_id, if event and request.method[0] == 'P' \ and self._payloads_enabled \ - and res_spec.payloads['enabled']: + and res_spec.payloads['enabled'] \ + and request.content_type == 'application/json': self._attach_payload(event, request.json, res_spec) events = [event]