Skip to content

Commit 83aed6d

Browse files
authoredNov 25, 2020
Trim spaces in header values for signature calculation (#875)
1 parent 6888347 commit 83aed6d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/main/signing.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ function getCanonicalRequest(method, path, headers, signedHeaders, hashedPayload
4949
throw new TypeError('hashedPayload should be of type "string"')
5050
}
5151
var headersArray = signedHeaders.reduce((acc, i) => {
52-
acc.push(`${i.toLowerCase()}:${headers[i]}`)
52+
// Trim spaces from the value (required by V4 spec)
53+
var val = `${headers[i]}`.replace(/ +/g, " ")
54+
acc.push(`${i.toLowerCase()}:${val}`)
5355
return acc
5456
}, [])
5557

0 commit comments

Comments
 (0)
Please sign in to comment.