mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Update utils.js (#3342)
update isFormdata,isArrayBuffer and isURLSearchParams, because value and Formdata(ArrayBuffer or URLSearchParams) are not the same Window sometimes. Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
+3
-3
@@ -54,7 +54,7 @@ function isArrayBuffer(val) {
|
|||||||
* @returns {boolean} True if value is an FormData, otherwise false
|
* @returns {boolean} True if value is an FormData, otherwise false
|
||||||
*/
|
*/
|
||||||
function isFormData(val) {
|
function isFormData(val) {
|
||||||
return (typeof FormData !== 'undefined') && (val instanceof FormData);
|
return toString.call(val) === '[object FormData]';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,7 +68,7 @@ function isArrayBufferView(val) {
|
|||||||
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
||||||
result = ArrayBuffer.isView(val);
|
result = ArrayBuffer.isView(val);
|
||||||
} else {
|
} else {
|
||||||
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ function isStream(val) {
|
|||||||
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
||||||
*/
|
*/
|
||||||
function isURLSearchParams(val) {
|
function isURLSearchParams(val) {
|
||||||
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
return toString.call(val) === '[object URLSearchParams]';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user