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

axios.getUri doesn't use baseURL #2468

Closed
friedrith opened this issue Oct 15, 2019 · 8 comments
Closed

axios.getUri doesn't use baseURL #2468

friedrith opened this issue Oct 15, 2019 · 8 comments

Comments

@friedrith
Copy link

friedrith commented Oct 15, 2019

Describe the bug
When using #1712 example and adding baseURL in config, baseURL seems to not be used.

To Reproduce

const axios = require("axios");
const fakeConfig = {
  method: "post",
  url: "/user/12345",
  baseURL: "/foo"
};
console.log(axios.getUri(fakeConfig));

Expected behavior
axios.getUri should return /foo/user/12345.

If this expected behavior seems right, I can work on a fix.

Environment:

  • Axios Version: 0.19.0
  • OS: Linux, Windows
  • Browser Chrome but also happen on Firefox and node
@yasuf
Copy link
Collaborator

yasuf commented Oct 15, 2019

Based on the definition of URI from this article getting just /user/12345 is a good URI, since it identifies what's being requested even though it doesn't locate the exact endpoint, if that's the case then getUri is working as expected. Let me know if you find a different definition! Otherwise we can just close the issue

@friedrith
Copy link
Author

friedrith commented Oct 16, 2019

URI may be only /user/12345 if you want to to identify the request locally to a endpoint. If you want to identifiy the request globally the endpoint URI should be including IHMO. URI specification shows examples including the protocole and the domain name https://tools.ietf.org/html/rfc3986. I think that getUri should include as many things as possible to identify the request.

@yasuf
Copy link
Collaborator

yasuf commented Oct 16, 2019

now that we're going to modify it, from the looks of it the URI should contain a full resource, so it might need to include the domain, etc from where the request is being made, e.g. https://github.com/foo/user/12345, might as well add that to this method

@friedrith
Copy link
Author

I agree. Depending on what is provided into the config, the method should return as much information as possible including protocol, domain, port, path, anchor, query, etc.

Alanscut added a commit to Alanscut/axios that referenced this issue Nov 16, 2019
@Alanscut
Copy link
Collaborator

Fixed in #2555

@axios axios locked and limited conversation to collaborators May 22, 2020
@jasonsaayman jasonsaayman reopened this Apr 7, 2021
@axios axios unlocked this conversation Apr 7, 2021
@sakarit-zz
Copy link
Contributor

PR #2555 was never merged so this should still be open. The solution looks valid though, so I guess a new PR could be opened. I will try to do that later.

@pfdgithub
Copy link

any progress?

@jasonsaayman
Copy link
Member

Fixed by #3737

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

No branches or pull requests

6 participants