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
Some use-cases may require allowing an empty URL #4407
Comments
I have also just encountered this problem, in that exact scenario as described above. |
I'd prefer not to pass the url at all. None of my requests have a url because they all go to a graphql server with the same url, i.e. myapp.herokuapp.com/graphql. I set up the baseURL in defaults and don't want or need to set a url on each request. Maybe a config option to ignore the missing url? |
I need to change #3916 to upgrade to node14, but on the other hand, I can't raise the version to 0.25.0 because of the this problem. Please fix it as soon as possible. |
Thanks for this, I am pretty conflicted on my final stance on this issue. On one side of the argument one could say that baseURL is exactly that, the base URL, therefore no path ie. {subdomain}.{domain}.{...extension}. However I can see the utility when one has only a single URL like @danthul. It would be nice to keep everyone happy, so I would like to give this some more thought come up with a solid solution to this, I will revert back after the weekend with my ideas. |
I write #3791, but I didn't given it enough thought. I agree to revert. |
My dev team was blocked from working yesterday due to this. We were getting the error:
We have not one, but a very considerable amount of cases in our code where I just spent an all-nighter debugging a monorepo with multiple large apps going down every nook and cranny, until I tested a different branch where what we were trying to fix just worked. The only noticeable difference? Axios |
also affected by this, please revert |
I have the same problem, please revert to avoid problems |
also affected by this, please revert |
😔 was blocked by this, please revert this change |
I will revert this for now, but in V1 this will no longer be the default. In v1 |
Thank you for reverting ❤️. |
Thanks for reverting :-) Why not make the |
Thanks! I agree that existing codebases shouldn't be taken too much into consideration when going forward with the project, but the fact that, judging from the reactions on this issue, the "empty URL" use-case obviously occurs a lot may justify some kind of escape hatch down the line. Allowing empty strings as |
We could potentially change the name to path, then make it not required, then this might make more sense, people can then implement We can also use a mapper to allow some backward compatibility with url to start off with and then add warnings and remove. |
I think you're hitting all the right keys with this last comment @jasonsaayman 🎉 Introducing breaking changes in a minor or patch version completely goes against the spirit of semantic versioning, but moving this change to v1, it's precisely what major version changes are for. Personally, first time I used an axios instance with a Also, in regards to allowing to use a mapper for backwars compatibility in v1, that's a good way to make adoption of v1 easier, which in the long run means less time maintaining v0 both for users of axios as well as maintainers. Thanks for the awesome work @jasonsaayman 🙌🏼 😄 |
Changes made with #4426 will release soon |
Thanks for the fix. |
Hey! Just a friendly reminder, that if this ever gets put back in, it would be nice to have the types follow to detect those issues before hand in TypeScript. Removing the optional of Line 77 in 73e3bdb
Thanks, |
Bumping axios to it's latest version [requires](axios/axios#4407) to not send empty strings as url. Therefore we had to adjust the intetral execution of `getSpace`
Bumping axios to it's latest version [requires](axios/axios#4407) to not send empty strings as url. Therefore we had to adjust the internal execution of `getSpace`
What's new? |
https://github.com/axios/axios/blob/v1.x/index.d.ts#L482 all the |
Is your feature request related to a problem? Please describe.
I'd like to give some feedback for the axios 0.25 release. #3791 introduces a fast failure when an empty string is provided as a URL to the request builder. However, my own and at least one other project are intentionally using empty strings as URLs and the 0.25 release breaks working code. It is listed as a breaking change in the changelog, but the behavior may be unpractical for some use-cases: Let's imagine a service abstraction over a RESTful resource; the
baseURL
could be something likehttp://example.com/examples
, avoiding passing/examples
as a path with each request. AGET
orPOST
request using""
as a URL would be valid in this case.Describe the solution you'd like
baseURL
asurl
toaxios.create
, but currently the presence of the URL is checked before merging the configs. Moving theif (!config.url) {
part down after the config merge would allow this escape hatch.I'd be happy to submit a PR if desired.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: