fix(remix-node): make global fetch return an instance of global Response#5095
fix(remix-node): make global fetch return an instance of global Response#5095acoreyj wants to merge 8 commits into
fetch return an instance of global Response#5095Conversation
|
|
Hi @acoreyj, Welcome, and thank you for contributing to Remix! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run. Thanks! - The Remix team |
|
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
|
Note that this blocks being able to use @authjs in remix node environments |
fetch return an instance of global Response
|
Hmm I'm struggling to think of ways to mock this test to work in CI as mocking the fetch obviously ruins the point, any thoughts @MichaelDeBoey @jacob-ebey |
|
@MichaelDeBoey I pulled out the logic for creating the response so I could mock the fetch itself and test this which should pass in the CI now |
| .then((res) => { | ||
| return getReturnableResponse(res); | ||
| }) | ||
| .catch((res) => { | ||
| return getReturnableResponse(res); | ||
| }); |
There was a problem hiding this comment.
This could have a smaller footprint if we do
| .then((res) => { | |
| return getReturnableResponse(res); | |
| }) | |
| .catch((res) => { | |
| return getReturnableResponse(res); | |
| }); | |
| .then(getReturnableResponse) | |
| .catch(getReturnableResponse); |
Closes: #4395
Testing Strategy:
This test covers this code: packages/remix-node/tests/fetch-test.ts
it("should return an instance of Response and WebResponse"