danieljoos/aws-sign-web

buildCanonicalRequest fails when using query params

Opened this issue · 3 comments

buildCanonicalRequest doesn't appear to work when query params are specified in the request. For example

signer.sign({
  method: 'GET',
  url: '/someurl',
  params: { myId: 'abc' }
});

This line breaks because ws.uri.queryParams[key] is a string and doesn't have sort(). It looks like this assumes the param values are always arrays. That's true if they came from SimpleQueryParser but normal params (merged with extend in prepare) are just strings/numbers.

I tried working around this by adding my own interceptor to wrap all may params in arrays but that doesn't work because Axios then appends [] to the key names.

I just noticed that my issue #20 is about the same problem. I did some research and I have a workaround in that issue that you might be interested in.

I've created a new pull request that should resolve this issue: #21

I've created a second pull request to bump the version: #22. I've also closed my own issue about this as it's a duplicate anyway: #20

We can close this one as soon as the version bump is done.