Skip to content

Commit

Permalink
update response headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Toozs committed Jul 22, 2024
1 parent 95140e3 commit 92d9273
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/api/objectPost.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ function objectPost(authInfo, request, streamingV4Params, log, callback) {
});
if (storingResult) {
// ETag's hex should always be enclosed in quotes
responseHeaders.location = `/${bucketName}/${encodeURIComponent(request.formData.key)}`;
responseHeaders.Bucket = bucketName;
responseHeaders.ETag = `"${storingResult.contentMD5}"`;
responseHeaders.location =
`${request.headers.host}/${bucketName}/${encodeURIComponent(request.formData.key)}`;
}
const vcfg = bucket.getVersioningConfiguration();
const isVersionedObj = vcfg && vcfg.Status === 'Enabled';
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/aws-node-sdk/test/object/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe('POST object', () => {
req.on('response', res => {
try {
assert.equal(res.statusCode, 204);
assert.equal(res.headers.location, `/${bucketName}/${filename}`);
assert.equal(res.headers.location, `${url.hostname}:${url.port}/${bucketName}/${filename}`);
done();
} catch (err) {
done(err);
Expand Down Expand Up @@ -234,7 +234,7 @@ describe('POST object', () => {
req.on('response', res => {
try {
assert.equal(res.statusCode, 204);
assert.equal(res.headers.location, `/${bucketName}/${encodedKey}`);
assert.equal(res.headers.location, `${url.hostname}:${url.port}/${bucketName}/${encodedKey}`);
done();
} catch (err) {
done(err);
Expand Down

0 comments on commit 92d9273

Please sign in to comment.