1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

More compact expression with dict.get()

This commit is contained in:
Aron Griffis
2015-08-24 14:22:12 -04:00
parent eda64bc3be
commit 646d12df94

View File

@@ -27,8 +27,7 @@ def remove_query_parameters(request, query_parameters_to_remove):
def remove_post_data_parameters(request, post_data_parameters_to_remove):
if request.method == 'POST' and not isinstance(request.body, BytesIO):
if ('Content-Type' in request.headers and
request.headers['Content-Type'] == 'application/json'):
if request.headers.get('Content-Type') == 'application/json':
json_data = json.loads(request.body.decode('utf-8'))
for k in list(json_data.keys()):
if k in post_data_parameters_to_remove: