fix(): fix unintentional pointer ref, fixes very rare sign issue if request is fired in parallel
This commit is contained in:
@@ -304,24 +304,31 @@ export default abstract class BaseRestClient {
|
|||||||
isPublicApi
|
isPublicApi
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!options.headers) {
|
const authHeaders = {
|
||||||
options.headers = {};
|
'ACCESS-KEY': this.apiKey,
|
||||||
}
|
'ACCESS-PASSPHRASE': this.apiPass,
|
||||||
options.headers['ACCESS-KEY'] = this.apiKey;
|
'ACCESS-TIMESTAMP': signResult.timestamp,
|
||||||
options.headers['ACCESS-PASSPHRASE'] = this.apiPass;
|
'ACCESS-SIGN': signResult.sign,
|
||||||
options.headers['ACCESS-TIMESTAMP'] = signResult.timestamp;
|
'Content-Type': 'application/json',
|
||||||
options.headers['ACCESS-SIGN'] = signResult.sign;
|
};
|
||||||
options.headers['Content-Type'] = 'application/json';
|
|
||||||
|
|
||||||
if (method === 'GET') {
|
if (method === 'GET') {
|
||||||
return {
|
return {
|
||||||
...options,
|
...options,
|
||||||
|
headers: {
|
||||||
|
...authHeaders,
|
||||||
|
...options.headers,
|
||||||
|
},
|
||||||
url: options.url + signResult.queryParamsWithSign,
|
url: options.url + signResult.queryParamsWithSign,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...options,
|
...options,
|
||||||
|
headers: {
|
||||||
|
...authHeaders,
|
||||||
|
...options.headers,
|
||||||
|
},
|
||||||
data: params,
|
data: params,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user