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.create() can't not handle params

See original GitHub issue

Describe the bug I created a instance with a param in it, but it doesn’t seem to work

I Have already decleared a instance axios in my js file

const instance = axios.create({
  baseURL: '/',
  params: {
    secret: 123
  }
})

I want to send a request like this /api/logout.json?secret=123

instance.get('/api/logout.json)
   .then((res) => {
   dispatch(changeLogin(false))
})

but after I use this instance to send a request the request is only /api/logout.json

What is this problem, did instance doesn’t received params?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:13

github_iconTop GitHub Comments

5reactions
evenfrostcommented, Jun 22, 2019

Actually this is already a duplicate and is addressed in #2190 and #2196, so cancel that.

0reactions
evenfrostcommented, Jun 22, 2019

@Zu3zz I believe this should not be closed until a PR with the fix is created and merged to avoid duplicate issues. As been already said, this is a regression bug, and you don’t have to stop using params in instance, rather don’t use 0.19 until that. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Default query params not getting passed in axios request
I'm using axios.create() to pass in a baseURL and some default query params like this axios.create({ baseURL: 'http://somebigurlhere', ...
Read more >
Understanding Axios.create - LogRocket Blog
Learn why and how to effectively use Axios.create in your next project with this in-depth tutorial and example build.
Read more >
Complete Guide to Axios HTTP Client - Reflectoring
Here we are using the async/await syntax to make a POST request with the axios.post() method. We are passing the new product to...
Read more >
How to Perform HTTP Requests with Axios – A Complete Guide
Let's look at how we can deal with an Axios POST request's response. ... The axios.get() method is used to make an HTTP...
Read more >
Making HTTP requests with Axios - CircleCI
This code snippet sends a GET request to the JSON API. Because the request returns a promise, you will use the .then() block...
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