From 99cd43dfd3c8954d33f9e00fc8d1596af06e87e7 Mon Sep 17 00:00:00 2001 From: lionel-rowe Date: Wed, 15 Feb 2023 19:54:03 +0800 Subject: [PATCH] fix: Correctly canonicalize query param spaces --- mod.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod.ts b/mod.ts index c06afb8..8ce5d64 100644 --- a/mod.ts +++ b/mod.ts @@ -76,7 +76,8 @@ export class AWSSignerV4 implements Signer { const urlObj = new URL(request.url); const { host, pathname, searchParams } = urlObj; searchParams.sort(); - const canonicalQuerystring = searchParams.toString(); + // per https://docs.aws.amazon.com/general/latest/gr/create-signed-request.html#create-canonical-request + const canonicalQuerystring = searchParams.toString().replaceAll("+", "%20"); const headers = new Headers(request.headers);