mirror of
https://github.com/tenrok/axios.git
synced 2026-05-27 14:47:43 +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
|
||||
*/
|
||||
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)) {
|
||||
result = ArrayBuffer.isView(val);
|
||||
} else {
|
||||
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
||||
result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -175,7 +175,7 @@ function isStream(val) {
|
||||
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
||||
*/
|
||||
function isURLSearchParams(val) {
|
||||
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
||||
return toString.call(val) === '[object URLSearchParams]';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user