From 2aeb62c726c3526d79242b99eeec166ad305e87f Mon Sep 17 00:00:00 2001 From: James Hadfield Date: Tue, 7 Nov 2023 15:57:40 +1300 Subject: [PATCH] [bugfix] default params for signedUrl() The default parameter values for this function would only be used in the case where no argument was provided, which makes no sense as a bucket and key will always be needed. --- src/s3.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/s3.js b/src/s3.js index 75650bedc..5f11a4b31 100644 --- a/src/s3.js +++ b/src/s3.js @@ -42,15 +42,15 @@ export async function* listObjects({bucket, prefix}) { * Generate a signed URL for an S3 object. * * @param {object} params - * @param {string} params.method - HEAD, GET, PUT, DELETE * @param {string} params.bucket - name of bucket * @param {string} params.key - object key + * @param {string} [params.method] - HEAD, GET, PUT, DELETE. Default: GET * @param {object} [params.headers] - Content-Type and/or Content-Encoding headers for PUT * @param {number} [params.expiresIn] - seconds until the URL expires * @param {number} [params.issuedAt] - absolute time in seconds since the Unix epoch at which the signed URL should be considered issued at, i.e. when the countdown for expiresIn starts * @returns {string} signed URL */ -export async function signedUrl({method, bucket, key, headers, expiresIn, issuedAt} = {method: "GET", headers: {}}) { +export async function signedUrl({method="GET", bucket, key, headers={}, expiresIn, issuedAt}) { const normalizedHeaders = normalizeHeaders(headers); const commands = new Map([