baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
+45
@@ -0,0 +1,45 @@
|
||||
import axios from 'axios'
|
||||
import utils from 'axios/lib/utils'
|
||||
import { adapter } from './adapter'
|
||||
import normalizeHeaderName from 'axios/lib/helpers/normalizeHeaderName'
|
||||
|
||||
function setContentTypeIfUnset(headers, value) {
|
||||
if(!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
||||
headers['Content-Type'] = value
|
||||
}
|
||||
}
|
||||
|
||||
axios.defaults.transformRequest = [
|
||||
function transformRequest(data, headers) {
|
||||
normalizeHeaderName(headers, 'Accept')
|
||||
normalizeHeaderName(headers, 'Content-Type')
|
||||
if(
|
||||
utils.isFormData(data)
|
||||
|| utils.isArrayBuffer(data)
|
||||
|| utils.isBuffer(data)
|
||||
|| utils.isStream(data)
|
||||
|| utils.isFile(data)
|
||||
|| utils.isBlob(data)
|
||||
) {
|
||||
return data
|
||||
}
|
||||
if(utils.isArrayBufferView(data)) {
|
||||
return data.buffer
|
||||
}
|
||||
if (utils.isURLSearchParams(data)) {
|
||||
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8')
|
||||
return data.toString()
|
||||
}
|
||||
if (utils.isObject(data)) {
|
||||
setContentTypeIfUnset(headers, 'application/json;charset=utf-8')
|
||||
return JSON.stringify(data)
|
||||
}
|
||||
return data
|
||||
}
|
||||
]
|
||||
|
||||
axios.defaults.adapter = adapter
|
||||
|
||||
export * from 'axios'
|
||||
|
||||
export { axios }
|
||||
Reference in new issue
Block a user