mhart / aws4

Signs and prepares Node.js requests using AWS Signature Version 4
MIT License
703 stars 176 forks source link

Allow `content-type` header to be disabled? #159

Open ryanblock opened 1 year ago

ryanblock commented 1 year ago

Per aws4 docs: headers['Content-Type'] (will use 'application/x-www-form-urlencoded; charset=utf-8' if not given and there is a body)

That's a totally sane default for most requests, and hasn't caused me issues to date! However for S3 PutObject requests, it means an unspecified content type will result in future S3 gets coming back as application/x-www-form-urlencoded, which is generally not correct.

Content type is not required metadata in S3 puts, so in this instance it'd probably be better to have no content-type header than the wrong one. As such, I'm thinking it would be nice to be able to disable the content type backfill if necessary.

Thoughts?