`merge` in utils convert an array post data to an object
See original GitHub issueSummary
try
let url = '/dsk',
let data = {
dsk: ['a1', 'a2']
}
let config = {
baseURL: 'http://8.8.8.8',
data
}
axios.post(url, data, {config}).then(resp => { console.log(resp.config.data) })
get resp.config.data
{"baseURL": "http://8.8.8.8", "url": "/dsk", "data": {"0": "a1", "1": "a2"}}
this config data is not expect.
Context
- axios version: v0.18.0
- Environment: node v10.4.1
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:6
Top Results From Across the Web
Merge keys array and values array into an object in JavaScript
You can combine two arrays with map method, then convert it with Object.fromEntries .
Read more >Merge Arrays into a New Object Array in Java - GeeksforGeeks
Given two arrays of the same type, they need to be merged into a new object array. The task is to merge the...
Read more >How to Convert an Array to Comma Separated String in Java
The simplest way to convert an array to comma separated String is to create a StringBuilder, iterate through the array, and add each...
Read more >array_merge - Manual - PHP
If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however,...
Read more >Quickstart - Guzzle Documentation
The client constructor accepts an associative array of options: base_uri ... use GuzzleHttp\Psr7\Request; // Create a PSR-7 request object to send $headers ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have met same situation. What I used for workaround is delete the
data
inconfig
, like:When
axios.post
be invoked, it will check its arguments and compare thedata
withconfig.data
. Ifconfig.data
is false value, it will using thedata
directly. Then themerge
will not be called.Closed in favor of #2567.