Skip to content

fix: fix default base as per URL spec#133

Merged
hugomrdias merged 1 commit intohugomrdias:masterfrom
acostalima:fix/default-base-envs-withou-location
Oct 21, 2020
Merged

fix: fix default base as per URL spec#133
hugomrdias merged 1 commit intohugomrdias:masterfrom
acostalima:fix/default-base-envs-withou-location

Conversation

@acostalima
Copy link
Copy Markdown
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