Skip to content

Commit

Permalink
[bugfix] default params for signedUrl()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jameshadfield committed Jan 1, 2024
1 parent 8fbf3de commit 2aeb62c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down

0 comments on commit 2aeb62c

Please sign in to comment.