-
-
Notifications
You must be signed in to change notification settings - Fork 850
feat(etag): add getBody option
#4201
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
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4201 +/- ##
========================================
Coverage 91.31% 91.32%
========================================
Files 168 168
Lines 10791 10796 +5
Branches 3186 3070 -116
========================================
+ Hits 9854 9859 +5
Misses 936 936
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Bundle size check
Compiler Diagnostics (typescript-go)
Reported by octocov |
Bundle size check
Compiler Diagnostics (tsc)
Reported by octocov |
|
@cjnoname Can you review this? |
Hey mate, It doesn't work because once you consume the ArrayBuffer, the stream is no longer available—you'll need to recreate the request at that point. This will work: let body: ArrayBuffer | ReadableStream<Uint8Array<ArrayBufferLike>> | null;
if (options?.arrayBuffer) {
body = await res.arrayBuffer();
c.res = new Response(body, {
status: res.status,
statusText: res.statusText,
headers: new Headers(res.headers)
});
} else {
body = res.clone().body;
} |
Fixes #4031
This PR introduces a new option
getBodyfor ETag middleware.This will help customize the function to get the content to generate a hash in such a way on the AWS Lambda, which can't use
c.res.clone().The author should do the following, if applicable
bun run format:fix && bun run lint:fixto format the code