mhart/aws4fetch

X-Amz-Content-Sha256 not being generated

Opened this issue · 3 comments

By the sigv4 documentation this is a mandatory header to be generated.

I can't seem to find a way of creating it. Is this a bug?

Which documentation? It's not mandatory for sigv4 signing alone – but some services use it (eg, S3). Most services don't though.

Yes, I didn't explain myself correctly... but could there be an optional parameter to expose this header?

Expose how? Sorry, can you explain what you're trying to do?

You can set this header yourself and aws4fetch should continue to work fine (in fact, it will use it for the signing and save having to calculate it)

If you want it yourself you can just do something like:

import { AwsV4Signer } from 'aws4fetch';
const signer = new AwsV4Signer({ url: '...', body: '...', ... });
const bodyHash = await signer.hexBodyHash();