File tree 1 file changed +9
-1
lines changed
packages/aws_signature_v4/lib/src/signer
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -256,7 +256,8 @@ class AWSSigV4Signer {
256
256
}) {
257
257
// The signing process requires component keys be encoded. However, the
258
258
// actual HTTP request should have the pre-encoded keys.
259
- final queryParameters = Map .of (canonicalRequest.queryParameters);
259
+ Map <String , String >? queryParameters =
260
+ Map .of (canonicalRequest.queryParameters);
260
261
261
262
// Similar to query parameters, some header values are canonicalized for
262
263
// signing. However their original values should be included in the
@@ -284,6 +285,13 @@ class AWSSigV4Signer {
284
285
}
285
286
}
286
287
288
+ // Web sends an OPTIONS request to verify CORS compatibility with the URL.
289
+ // A 404 can be returned if the URL contains unexpected query Parameters
290
+ // and URI.toString() appends a "?" to the URL for an empty query parameter
291
+ // map. Set the query parameter to null if it empty to avoid this.
292
+ // https://github.com/dart-lang/sdk/issues/51656
293
+ queryParameters = queryParameters.isEmpty ? null : queryParameters;
294
+
287
295
// On Web, sign the `Host` and `Content-Length` headers, but do not send
288
296
// them as part of the request, since these will be included automatically
289
297
// by the browser and most now restrict the ability to set them via code.
You can’t perform that action at this time.
0 commit comments