优化首页的下拉刷新、数据排序、绑定后刷新
This commit is contained in:
22
node_modules/axios/lib/helpers/resolveConfig.js
generated
vendored
22
node_modules/axios/lib/helpers/resolveConfig.js
generated
vendored
@ -10,7 +10,7 @@ import buildURL from "./buildURL.js";
|
||||
export default (config) => {
|
||||
const newConfig = mergeConfig({}, config);
|
||||
|
||||
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
||||
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
||||
|
||||
newConfig.headers = headers = AxiosHeaders.from(headers);
|
||||
|
||||
@ -23,17 +23,21 @@ export default (config) => {
|
||||
);
|
||||
}
|
||||
|
||||
let contentType;
|
||||
|
||||
if (utils.isFormData(data)) {
|
||||
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
||||
headers.setContentType(undefined); // Let the browser set it
|
||||
} else if ((contentType = headers.getContentType()) !== false) {
|
||||
// fix semicolon duplication issue for ReactNative FormData implementation
|
||||
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
||||
headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
||||
headers.setContentType(undefined); // browser handles it
|
||||
} else if (utils.isFunction(data.getHeaders)) {
|
||||
// Node.js FormData (like form-data package)
|
||||
const formHeaders = data.getHeaders();
|
||||
// Only set safe headers to avoid overwriting security headers
|
||||
const allowedHeaders = ['content-type', 'content-length'];
|
||||
Object.entries(formHeaders).forEach(([key, val]) => {
|
||||
if (allowedHeaders.includes(key.toLowerCase())) {
|
||||
headers.set(key, val);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add xsrf header
|
||||
// This is only done if running in a standard browser environment.
|
||||
|
||||
Reference in New Issue
Block a user