requests-auth-aws-sigv4
requests-auth-aws-sigv4 copied to clipboard
Setting `Content-Type` header without regard for the payload type causes issues
For example, I am doing a PUT with a large binary payload (and not setting content-type explicitly because nobody cares about it).
Some of the tests use a mock (moto), which in turn uses werkzeug and it will try to interpret the form data.. which is not parseable in this case...
I am not sure why we set Content-Type here at all, it does not seem to be required?
You are correct, the Content-Type header is not required. I'm not sure why it was originally included -- perhaps it was a convenience for some AWS service that might require it, but I can't recall which service anymore.
The requirement is this:
If the Content-Type header is present in the request, you must add it to the CanonicalHeaders list.
I'll add this to my todo to fix in the future. If you have the bandwidth, please submit a PR with this change.