question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

axios.getUri doesn't use baseURL

See original GitHub issue

Describe the bug When using https://github.com/axios/axios/pull/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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
sakaritcommented, Apr 7, 2021

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.

1reaction
friedrithcommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Check Axios request url before sending - Stack Overflow
I am within the Expo , React Native environment. Working example using fetch: const url = `https://maps.googleapis.com/maps/api/geocode/json ...
Read more >
Request Config | Axios Docs
It can be convenient to set `baseURL` for an instance of axios to pass relative URLs // to methods of that instance. baseURL:...
Read more >
axios how to replace baseURL when calling Code Example
axios.defaults.baseURL = '/api/';
Read more >
axios configure base url Code Example
axios.defaults.baseURL = '/api/';
Read more >
Use your own base url - orval.dev
Use your own base url. orval doesn't set any base url by default but you have multiple possibility to add it. Axios. You...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found