mirror of
https://github.com/tenrok/axios.git
synced 2026-06-08 17:22:34 +03:00
Fixed a regression bug with unsubscribing from cancel token; (#4819)
Reverts #4795; Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
@@ -100,7 +100,6 @@ function setProxy(options, configProxy, location) {
|
||||
/*eslint consistent-return:0*/
|
||||
export default function httpAdapter(config) {
|
||||
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
||||
let onCanceled;
|
||||
let data = config.data;
|
||||
const responseType = config.responseType;
|
||||
const responseEncoding = config.responseEncoding;
|
||||
@@ -118,11 +117,11 @@ export default function httpAdapter(config) {
|
||||
isFinished = true;
|
||||
|
||||
if (config.cancelToken) {
|
||||
config.cancelToken.unsubscribe(onCanceled);
|
||||
config.cancelToken.unsubscribe(abort);
|
||||
}
|
||||
|
||||
if (config.signal) {
|
||||
config.signal.removeEventListener('abort', onCanceled);
|
||||
config.signal.removeEventListener('abort', abort);
|
||||
}
|
||||
|
||||
emitter.removeAllListeners();
|
||||
|
||||
+1
-6
@@ -232,11 +232,6 @@ export default function xhrAdapter(config) {
|
||||
}
|
||||
}
|
||||
|
||||
// false, 0 (zero number), and '' (empty string) are valid JSON values
|
||||
if (!requestData && requestData !== false && requestData !== 0 && requestData !== '') {
|
||||
requestData = null;
|
||||
}
|
||||
|
||||
const protocol = parseProtocol(fullPath);
|
||||
|
||||
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
||||
@@ -246,6 +241,6 @@ export default function xhrAdapter(config) {
|
||||
|
||||
|
||||
// Send the request
|
||||
request.send(requestData);
|
||||
request.send(requestData || null);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user