Comparing version 1.0.2 to 1.0.3
16
index.js
import { XEAjax } from './src/constructor' | ||
import { isFormData } from './src/util' | ||
import ajax from './src/ajax' | ||
@@ -7,17 +6,2 @@ | ||
// set request header | ||
XEAjax.oninterceptor = function (request, next) { | ||
if (!isFormData(request.method === 'get' ? request.params : request.body)) { | ||
if (request.bodyMode === 'json') { | ||
request.setHeader('Content-Type', 'application/json; charset=utf-8') | ||
} else { | ||
request.setHeader('Content-Type', 'application/x-www-form-urlencoded') | ||
} | ||
} | ||
if (request.crossOrigin) { | ||
request.setHeader('X-Requested-With', 'XMLHttpRequest') | ||
} | ||
next() | ||
} | ||
/** | ||
@@ -24,0 +8,0 @@ * Install Vue plugin |
{ | ||
"name": "vxe-ajax", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "vxe-ajax 使用Promise提供便捷函数式调用api", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
import { XEAjaxRequest } from './request' | ||
import { XEAjaxResponse } from './response' | ||
import { XEPromise } from './promise' | ||
import { isFunction, isUndefined, eachObj } from './util' | ||
import { isFunction, isFormData, isUndefined, eachObj } from './util' | ||
@@ -189,1 +189,16 @@ var setupInterceptors = [] | ||
} | ||
// set request header | ||
XEAjax.oninterceptor = function (request, next) { | ||
if (!isFormData(request.method === 'get' ? request.params : request.body)) { | ||
if (request.bodyMode === 'json') { | ||
request.setHeader('Content-Type', 'application/json; charset=utf-8') | ||
} else { | ||
request.setHeader('Content-Type', 'application/x-www-form-urlencoded') | ||
} | ||
} | ||
if (request.crossOrigin) { | ||
request.setHeader('X-Requested-With', 'XMLHttpRequest') | ||
} | ||
next() | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20267
475