Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing upload status header in resumable upload finalise response #4407

Merged
merged 2 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/storage-emulator-integration/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2127,14 +2127,17 @@ describe("Storage emulator", () => {
})
.expect(200);

await supertest(STORAGE_EMULATOR_HOST)
const uploadStatus = await supertest(STORAGE_EMULATOR_HOST)
.put(uploadURL.pathname + uploadURL.search)
.set({
// No Authorization required in finalize
"X-Goog-Upload-Protocol": "resumable",
"X-Goog-Upload-Command": "upload, finalize",
})
.expect(200);
.expect(200)
.then((res) => res.header["x-goog-upload-status"]);

expect(uploadStatus).to.equal("final");

await supertest(STORAGE_EMULATOR_HOST)
.get(`/v0/b/${storageBucket}/o/test_upload.jpg`)
Expand Down
1 change: 1 addition & 0 deletions src/emulator/storage/apis/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ export function createFirebaseEndpoints(emulator: StorageEmulator): Router {
throw err;
}

res.header("x-goog-upload-status", "final");
storedMetadata.addDownloadToken(/* shouldTrigger = */ false);
return res.status(200).json(new OutgoingFirebaseMetadata(storedMetadata));
}
Expand Down