2023-03-24 20:15:51 +08:00
|
|
|
import { getAdapterDefault } from './adapter';
|
2023-03-23 20:09:00 +08:00
|
|
|
import { AxiosRequestConfig } from './core/Axios';
|
|
|
|
|
|
|
|
const defaults: AxiosRequestConfig = {
|
|
|
|
adapter: getAdapterDefault(),
|
|
|
|
headers: {
|
|
|
|
common: {
|
|
|
|
Accept: 'application/json, test/plain, */*',
|
|
|
|
},
|
|
|
|
options: {},
|
|
|
|
get: {},
|
|
|
|
head: {},
|
|
|
|
post: {
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
|
|
|
},
|
|
|
|
put: {
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
|
|
|
},
|
|
|
|
delete: {},
|
|
|
|
trace: {},
|
|
|
|
connect: {},
|
|
|
|
},
|
|
|
|
validateStatus(status: number): boolean {
|
|
|
|
return status >= 200 && status < 300;
|
|
|
|
},
|
|
|
|
timeout: 10000,
|
|
|
|
dataType: 'json',
|
|
|
|
responseType: 'text',
|
|
|
|
};
|
|
|
|
|
|
|
|
export default defaults;
|