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.

Request params are not getting merged with instance params

See original GitHub issue

Describe the bug

Specific request params do not get merged with the instance default params.

To Reproduce

const instance = axios.create({
    baseURL: "http://www.example.com",
    params: {
      q: "question",
    }
  });
instance.get("/page", 
  { 
    params: { 
      page: 2 
    }
  }
)

What happens is that the request param object overrides the instance default param object. The instance no longer has a query param of q.

Expected behavior

According to the docs, all configuration options are merged. https://github.com/axios/axios#instance-methods

I expected request to contain both q and page params. This is also how it was working in version 0.18.0, which is how I noticed.

Environment:

  • Axios Version: 0.19.0
  • OS: 10.14.5 (18F132)
  • Browser: Node Express, and Chrome
  • Browser: Node 10.15.0, Chrome Version 74.0.3729.169 (Official Build) (64-bit)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:110
  • Comments:84 (8 by maintainers)

github_iconTop GitHub Comments

42reactions
nghiepdevcommented, Jun 14, 2019

Waiting for an official fix 😭

12reactions
miroshnikcommented, Jan 31, 2020

some kind of endless drama

Read more comments on GitHub >

github_iconTop Results From Across the Web

Axios get in url works but with second parameter as object it ...
axios.get accepts a request config as the second parameter (not query string params). You can use the params config option to set query...
Read more >
GET Request Query Params with Axios - Mastering JS
The easiest way to make a GET request with Axios is the axios.get() function. The 2nd parameter to axios.get() is the Axios options:...
Read more >
Quickstart — Requests 2.28.1 documentation
Quickstart¶. Eager to get started? This page gives a good introduction in how to get started with Requests. First, make sure that: Requests...
Read more >
Quickstart - Guzzle Documentation
You can provide query string parameters with a request in several ways. You can set query string parameters in the request's URI: $response...
Read more >
Request Parameters API | Apache Solr Reference Guide 6.6
This file is kept in ZooKeeper or in the conf directory of a standalone Solr instance. The settings stored in params.json are used...
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