Skip to content

Commit

Permalink
Merge pull request #329 from happo/finalize-url
Browse files Browse the repository at this point in the history
Use correct URL for finalizing signed URL uploads
  • Loading branch information
lencioni authored Feb 14, 2025
2 parents 0f7ee39 + e5f6c9b commit 881e66f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/uploadAssets.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async function uploadAssetsWithSignedUrl(
// Finally, we need to tell Happo that we've uploaded the assets.
const finalizeRes = await makeRequest(
{
url: `${endpoint}/api/snap-requests/assets/${hash}/finalize`,
url: `${endpoint}/api/snap-requests/assets/${hash}/signed-url/finalize`,
method: 'POST',
json: true,
},
Expand Down
8 changes: 5 additions & 3 deletions test/integrations/react-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ beforeEach(() => {
},
},

'POST /assets/:hash/finalize': {
'POST /assets/:hash/signed-url/finalize': {
method: 'POST',
url: /\/assets\/[a-f0-9]+\/finalize$/,
url: /\/assets\/[a-f0-9]+\/signed-url\/finalize$/,
handler: (req, res) => {
const parts = req.url.split('/');
const hash = parts[parts.length - 2];
Expand Down Expand Up @@ -462,7 +462,9 @@ describe('when HAPPO_SIGNED_URL is set', () => {
expect(receivedRequests[1].url).toMatch(/\/a-signed-url$/);

expect(receivedRequests[2].method).toBe('POST');
expect(receivedRequests[2].url).toMatch(/\/assets\/[a-f0-9]+\/finalize$/);
expect(receivedRequests[2].url).toMatch(
/\/assets\/[a-f0-9]+\/signed-url\/finalize$/,
);

// The request after the asset has been finalized is posting the report
expect(receivedRequests[3].method).toBe('POST');
Expand Down

0 comments on commit 881e66f

Please sign in to comment.