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: fix default base as per URL spec #133

Merged

Conversation

acostalima
Copy link
Contributor

@acostalima acostalima commented Oct 20, 2020

The default value set for base was causing issues in environments such as React Native where .location does not exist. Furthermore, when base is unspecified the default value should be undefined instead of an empty string.

I'm assuming package-lock.json should be ignored considering it was not previously committed. As such, I've added it to the ignore file.

I wasn't really sure how to go about testing this change. AFAIK, it's not possible to remove location from window as Playwright/Chromium complains if I try delete it. The hack I came up with is to construct the browser URL in Node to simulate a React Native-like environment without location. Truth to be told, I don't like this approach but this is what we can get away with for the time being to ensure a regression is not introduced.

What do you think @hugomrdias?

This PR aims to fix ipfs/js-ipfs#3332.

@hugomrdias hugomrdias changed the title Fix default base as per URL spec fix: fix default base as per URL spec Oct 21, 2020
@hugomrdias hugomrdias merged commit e816fea into hugomrdias:master Oct 21, 2020
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.

HTTP client factory: Invalid base URL
2 participants