-
-
Notifications
You must be signed in to change notification settings - Fork 363
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
TypeError relative URL after upgrading to 0.5.0 #58
Comments
Downgrading to 0.4.1 solved it. |
This regression was introduced in a7c71b5. We needed to convert the string URL into an @sholladay Do you know what |
Oy sorry about that. I wanted to write a test for that case, but we didn't have Cypress set up at the time and couldn't get it to work with |
Fixes #58 There was a regression introduced in a7c71b5 which broke the ability for `input` to be a relative URL like `foo` or `/foo`. The root cause is that [`window.URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) unfortunately does not support relative URLs without an explicit and absolute `base` argument. This fixes that and adds a test for it. Now that we have Cypress set up, we can properly test anything related to relative URLs. The goal is to follow the URL resolution rules the same way that `fetch` does. So we resolve `input` against [`document.baseURI`](https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI#The_base_URL_of_a_document).
Fixes sindresorhus/ky#58 There was a regression introduced in sindresorhus/ky@a7c71b5 which broke the ability for `input` to be a relative URL like `foo` or `/foo`. The root cause is that [`window.URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL) unfortunately does not support relative URLs without an explicit and absolute `base` argument. This fixes that and adds a test for it. Now that we have Cypress set up, we can properly test anything related to relative URLs. The goal is to follow the URL resolution rules the same way that `fetch` does. So we resolve `input` against [`document.baseURI`](https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI#The_base_URL_of_a_document).
I've got this code:
it used to work just fine in 0.4.1, but busted now.
In Firefox I get
TypeError: /api/cards/ is not a valid URL.
on this line:In Chrome I get a lot more helpful error:
The text was updated successfully, but these errors were encountered: