case insensitive search for "json" in content-type headers

This commit is contained in:
laurynas 2016-07-05 11:31:18 -04:00
parent 23b81324d1
commit 560f50ab9a

View File

@ -10,6 +10,7 @@ import json
import ssl
import certifi
import logging
import re
# python 2 and python 3 compatibility library
from six import iteritems
@ -121,7 +122,7 @@ class RESTClientObject(object):
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
if query_params:
url += '?' + urlencode(query_params)
if headers['Content-Type'].find('json') != -1:
if re.search('json', headers['Content-Type'], re.IGNORECASE):
request_body = None
if body:
request_body = json.dumps(body)