diff options
author | Tim Burke <tim.burke@gmail.com> | 2020-02-27 10:39:38 -0800 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2021-03-01 10:55:15 -0800 |
commit | 81db9806901a83f4d0016446cdc48e700ab6e788 (patch) | |
tree | e4cdf38e3e807ec9192f49894b3ad699fb6ec6dd /test/cors/harness.js | |
parent | c5152ed4d3a37c5e0017be9f0445bf0868561b96 (diff) | |
download | swift-81db9806901a83f4d0016446cdc48e700ab6e788.tar.gz |
s3api: Pass through CORS headers
This adds support for presigned GET URLs, at least.
Note that there is no support yet for preflight requests, so a whole
bunch of other CORS stuff *doesn't* work (yet). This was just an easy
first step.
Change-Id: I43150a630a2a7620099e6bfecaed3bbe958ba423
Diffstat (limited to 'test/cors/harness.js')
-rw-r--r-- | test/cors/harness.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/cors/harness.js b/test/cors/harness.js index 64a750092..abd4b13b2 100644 --- a/test/cors/harness.js +++ b/test/cors/harness.js @@ -14,10 +14,17 @@ function makeUrl (path) { export function MakeRequest (method, path, headers, body, params) { var url = makeUrl(path) + headers = headers || {} params = params || {} - // give each request a unique query string to avoid ever fetching from cache - params['cors-test-time'] = Date.now().toString() - params['cors-test-random'] = Math.random().toString() + if (!( + url.searchParams.has('Signature') || + url.searchParams.has('X-Amz-Signature') || + 'Authorization' in headers + )) { + // give each Swift request a unique query string to avoid ever fetching from cache + params['cors-test-time'] = Date.now().toString() + params['cors-test-random'] = Math.random().toString() + } for (var key in params) { url.searchParams.append(key, params[key]) } |