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.

Breaking change in v0.20.0

See original GitHub issue

Describe the bug

A breaking change was introduced here: https://github.com/axios/axios/pull/2844/files?file-filters[]=.js&hide-deleted-files=true#diff-597f69416721110963cbbdf72c6d4e6e30d77da5073041b4b10a702c0a7186f0R76

Previously a GET request would be able to include data, since before the change above util.merge would keep the data property passed in config. Now the mergeConfig function will ignore the data property in config, causing the request to be made without data.

Whether or not a GET request should be able to send a body is debatable I guess, but this change should probably be documented somewhere.

To Reproduce

var utils = require("./utils");
var mergeConfig = require("./core/mergeConfig");

console.log("--- mergeConfig --- ");
console.log(
  mergeConfig(
    { data: { hello: "world" } },
    {
      method: "get",
      url: "https://test.com",
    }
  )
);

console.log("--- utils.merge ---");
console.log(
  utils.merge(
    { data: { hello: "world" } },
    {
      method: "get",
      url: "https://test.com",
    }
  )
);

Result:

--- mergeConfig --- 
{ url: 'https://test.com', method: 'get' }
--- utils.merge ---
{ data: { hello: 'world' },
  method: 'get',
  url: 'https://test.com' }

Expected behavior

A clear and concise description of what you expected to happen.

Environment

  • Axios Version [e.g. 0.18.0] 0.20.0
  • Adapter [e.g. XHR/HTTP] HTTP
  • Browser [e.g. Chrome, Safari] Node
  • Browser Version [e.g. 22]
  • Node.js Version [e.g. 13.0.1] v10.14.1
  • OS: [e.g. iOS 12.1.0, OSX 10.13.4] OSX
  • Additional Library Versions [e.g. React 16.7, React Native 0.58.0]

Additional context/Screenshots

Add any other context about the problem here. If applicable, add screenshots to help explain.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
nick-w-nickcommented, Oct 13, 2020

Just as a bump, this issue is impacting me as well. I just noticed it today after upgrading from 0.19.2 to 0.20.0.

I have several systems that interact with APIs that require a request body with certain GET requests, which are now not working after the upgrade since the data property in the config object is being ignored.

Behavior on 0.19.2

const config = {
    data: {
        prop1: 'prop1value',
        prop2: 'prop2value'
    }
}

Axios.get('https://website.com/api/endpoint', config);

Request being sent: GET https://website.com/api/endpoint Request Body:

{
    prop1: 'prop1value',
    prop2: 'prop2value'
}

Behavior on 0.20.0

const config = {
    data: {
        prop1: 'prop1value',
        prop2: 'prop2value'
    }
}

Axios.get('https://website.com/api/endpoint', config);

Request being sent: GET https://website.com/api/endpoint Request Body: (blank)

0reactions
ionTeacommented, Oct 16, 2020

I think so too, I’ll close this 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrading to v0.20 - dbt Developer Hub
The biggest breaking change is that all tests now return a set of failing rows, rather than a single numeric value. This resolved...
Read more >
Changelog | TypeDoc
This change breaks all existing custom themes, so a theme created for v0.21 ... references to type parameters have produced a ReferenceType since...
Read more >
Releasing CloudQuery v0.20.0
This release introduced a breaking change to our protocol, this requires upgrading all providers to their latest version, moreover, if you get ...
Read more >
Vector v0.20.1 release notes
When upgrading, we recommend stepping through minor versions as these can each contain breaking changes while Vector is pre-1.0. These breaking changes are ......
Read more >
Upgrade Guide - Karpenter
Note this does not mean every minor upgrade has a breaking change as we ... /v0.20.0/pkg/apis/crds/karpenter.k8s.aws_awsnodetemplates.yaml.
Read more >

github_iconTop Related Medium Post

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