vcrpy
vcrpy copied to clipboard
When filtering post data, handle ContentType with specified charset (ex: 'application/json;charset=UTF-8')
Hello,
Regarding the website Amundi.com, I was unable to filter the POST data username & password. The Content-Type set is "application/json;charset=UTF-8", so strict comparison with "application/json" is not possible.
Thanks for this great python module!
FYI json must be in UTF8, so that flag is redundant.
Matching the prefix is also incorrect, because it would include application/json-not-really-json
Maybe https://pypi.python.org/pypi/python-mimeparse will help
Hi,
Probably you read too quickly so you misunderstood the patch, FYI d.get(X, '') returns None when d[X] == None. Regarding mimeparse I do not think adding a dependency for a so much small problem is a good idea. I have updated this PR using standard cgi module (like mimeparse), and kept the logic as it was before.
Imho the best way to do would be to try except a json.loads instead of relying on Content-Type, but it is not aligned with the coding style.
Hello @graingert , The last build has failed because of a flickr timeout, can you please relaunch it ?
@poussik thanks for your PR! Sorry for the delay, but your propose really makes sense.
Can you update your branch so we can follow with the review/merge process? :slightly_smiling_face: