Skip to content

Commit

Permalink
fix remix-run#4395 for global instanceof Response
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyEntropy committed Jan 13, 2023
1 parent 6c154d2 commit 6f8d665
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/remix-node/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,15 @@ export const fetch: typeof webFetch = (
...init,
};

return webFetch(info, init as RequestInit);
return webFetch(info, init as RequestInit)
.then((res) => {
if (res instanceof WebResponse && !(res instanceof NodeResponse))
return new NodeResponse(res.body, res);
return res;
})
.catch((res) => {
if (res instanceof WebResponse && !(res instanceof NodeResponse))
return new NodeResponse(res.body, res);
return res;
});
};

0 comments on commit 6f8d665

Please sign in to comment.