Skip to content

Commit

Permalink
fix: apply review feedbacks
Browse files Browse the repository at this point in the history
Co-authored-by: Attila Večerek <[email protected]>
  • Loading branch information
AllanZhengYP and vecerek committed Nov 21, 2020
1 parent cf0590f commit 94e7b4c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/s3-request-presigner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ If your request contains server-side encryption(`x-amz-server-side-encryption*`)
headers, because of S3 limitation, you need to send these headers along
with the presigned url. That is to say, the url only from calling `formatUrl()`
to `presigned` is not sufficient to make a request. You need to send the
server-side encryption headers along with url. These headers remain in the
server-side encryption headers along with the url. These headers remain in the
`presigned.headers`

For more information, please go to [S3 SSE reference](https://docs.aws.amazon.com/AmazonS3/latest/dev/KMSUsingRESTAPI.html)
7 changes: 6 additions & 1 deletion packages/s3-request-presigner/src/presigner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,16 @@ describe("s3 presigner", () => {
headers: {
...minimalRequest.headers,
"x-amz-server-side-encryption": "kms",
"x-amz-server-side-encryption-customer-algorithm": "AES256",
},
});
expect(signed.headers).toMatchObject({
"x-amz-server-side-encryption": "kms",
});
expect(signed.query?.["X-Amz-SignedHeaders"]).toEqual(expect.stringContaining("x-amz-server-side-encryption"));
const signedHeadersHeader = signed.query?.["X-Amz-SignedHeaders"];
const signedHeaders =
typeof signedHeadersHeader === "string" ? signedHeadersHeader.split(";") : signedHeadersHeader;
expect(signedHeaders).toContain("x-amz-server-side-encryption");
expect(signedHeaders).toContain("x-amz-server-side-encryption-customer-algorithm");
});
});
6 changes: 3 additions & 3 deletions packages/types/src/signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ export interface RequestPresigningArguments extends RequestSigningArguments {
expiresIn?: number;

/**
* A set of string whose members represents headers that should not be hoisted
* to presigned request's query string. If not supplied, the presigner will
* move all the AWS-specific headers(starting with `x-amz-`) to the request
* A set of strings whose representing headers that should not be hoisted
* to presigned request's query string. If not supplied, the presigner
* moves all the AWS-specific headers (starting with `x-amz-`) to the request
* query string. If supplied, these headers remain in the presigned request's
* header.
* All headers in the provided request will have their names converted to
Expand Down

0 comments on commit 94e7b4c

Please sign in to comment.