Skip to content
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

fix: resolve headers when cross fetch is not available in environment #296

Conversation

vasco-santos
Copy link
Contributor

This module supports using a custom fetch method, which is great when fetch is not supported in a given environment.

However, resolveHeaders function does not have into account that cross-fetch might be undefined. This was creating problems for me when using this module in a Cloudflare worker with the error: TypeError: Right-hand side of 'instanceof' is not an object.

This should have tests to avoid regressions, but at this point is quite complex to setup a test environment for this. I would suggest we can use something like https://github.com/hugomrdias/playwright-test and run tests in a service worker, but I left this for a follow up PR as I am not sure about how you would prefer to deal with this.

@vasco-santos vasco-santos force-pushed the fix/resolve-headers-when-cross-fetch-not-available-in-environment branch from 8fbb6aa to 4d04790 Compare October 22, 2021 19:54
@faizan-ali
Copy link

Can we merge these changes? Our setup uses fetch-vcr which stubs out cross-fetch for a custom implementation of fetch globally through Jest - this modul's assumption of cross-fetch is breaking our testing setup.

Copy link
Member

@jasonkuhrt jasonkuhrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jasonkuhrt jasonkuhrt merged commit 55b1bf5 into graffle-js:master Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants