2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00

Fixed query params composing; (#5018)

* Fixes #4999;

* Added regression test;
This commit is contained in:
Dmitriy Mozgovoy
2022-10-05 22:29:50 +03:00
committed by GitHub
parent d61dbede95
commit 3e4d52171e
2 changed files with 21 additions and 3 deletions
+8 -3
View File
@@ -301,9 +301,14 @@ export default function httpAdapter(config) {
auth && headers.delete('authorization');
const path = parsed.pathname.concat(parsed.searchParams);
let path;
try {
buildURL(path, config.params, config.paramsSerializer).replace(/^\?/, '');
path = buildURL(
parsed.pathname + parsed.search,
config.params,
config.paramsSerializer
).replace(/^\?/, '');
} catch (err) {
const customErr = new Error(err.message);
customErr.config = config;
@@ -315,7 +320,7 @@ export default function httpAdapter(config) {
headers.set('Accept-Encoding', 'gzip, deflate, br', false);
const options = {
path: buildURL(path, config.params, config.paramsSerializer).replace(/^\?/, ''),
path,
method: method,
headers: headers.toJSON(),
agents: { http: config.httpAgent, https: config.httpsAgent },