added test upload

This commit is contained in:
goro 2026-05-05 18:58:52 +03:00
parent bc7b0e6773
commit 7846686757
3 changed files with 2 additions and 8 deletions

View File

@ -65,10 +65,7 @@ export default {
Key: key, Key: key,
}); });
const presignedUrl = await getSignedUrl(client, command, { const presignedUrl = await getSignedUrl(client, command, { expiresIn: 3600 });
expiresIn: 3600,
unhoistableHeaders: new Set(['x-amz-content-sha256']),
});
return json({ url: presignedUrl, key }, 200, cors); return json({ url: presignedUrl, key }, 200, cors);
} catch (err) { } catch (err) {

View File

@ -52,10 +52,7 @@ describe('R2 upload', () => {
const uploadRes = await fetch(url, { const uploadRes = await fetch(url, {
method: 'PUT', method: 'PUT',
headers: { headers: { 'Content-Type': 'image/png' },
'Content-Type': 'image/png',
'x-amz-content-sha256': 'UNSIGNED-PAYLOAD',
},
body: IMAGE, body: IMAGE,
}); });

BIN
pictures/image2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 KiB