Skip to content

Commit

Permalink
fix: set headers after setResponse in Fetch handler (#8828)
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired authored Sep 4, 2023
1 parent 04269bf commit aa8b699
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/request/src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ const _fetch: typeof fetch =
const Fetch = {
async request(context: Context) {
const response = await _fetch(context.request.url!, context.request);
context.setResponse(response);

if (!response.headers.has('date')) {
response.headers.set('date', new Date().toUTCString());
}

context.setResponse(response);

// if we are an error, we will want to throw
if (!response.ok || response.status >= 400) {
const text = await response.text();
Expand Down

0 comments on commit aa8b699

Please sign in to comment.