Skip to content

Commit 375e601

Browse files
Merge pull request #1234 from trochol/retry-fix-branch
fix: clone axios args and req config #1232
2 parents 345ad55 + 9f99b9c commit 375e601

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/http.service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,18 @@ export class HttpService {
127127
...args: any[]
128128
) {
129129
return new Observable<AxiosResponse<T>>(subscriber => {
130-
let config: AxiosRequestConfig = args[args.length - 1];
131-
if (!config) {
132-
config = {};
133-
}
130+
const argsCopy = [...args];
131+
const configIdx = argsCopy.length - 1;
132+
const config: AxiosRequestConfig = { ...(argsCopy[configIdx] || {}) };
133+
argsCopy[configIdx] = config;
134134

135135
let cancelSource: CancelTokenSource;
136136
if (!config.cancelToken) {
137137
cancelSource = Axios.CancelToken.source();
138138
config.cancelToken = cancelSource.token;
139139
}
140140

141-
axios(...args)
141+
axios(...argsCopy)
142142
.then(res => {
143143
subscriber.next(res);
144144
subscriber.complete();

0 commit comments

Comments
 (0)