Skip to content

Commit 1023e41

Browse files
committed
fix: check content type correctly
1 parent 24a7756 commit 1023e41

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/four-mayflies-speak.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"middy-store-s3": patch
3+
---
4+
5+
fix: check content type correctly

packages/store-s3/src/store.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,14 @@ export class S3Store implements StoreInterface<unknown, S3Reference> {
208208
const payload = await Body?.transformToString("utf-8");
209209
if (payload === undefined) throw new Error("Payload is undefined");
210210

211-
return payload as unknown;
211+
return payload;
212212
}
213213

214214
if (ContentType?.startsWith("application/json")) {
215215
const payload = await Body?.transformToString("utf-8");
216216
if (payload === undefined) throw new Error("Payload is undefined");
217217

218-
return JSON.parse(payload) as unknown;
218+
return JSON.parse(payload);
219219
}
220220

221221
// TODO handle other content types like 'application/octet-stream'

0 commit comments

Comments
 (0)