Merge pull request #332 from RickCole21/master

example fecher headers fix
This commit is contained in:
liaoxuezhi 2019-11-07 19:38:16 +08:00 committed by GitHub
commit d53805dee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -92,7 +92,10 @@ export default function(schema) {
router.push(to);
}
},
fetcher: ({url, method, data, config}) => {
fetcher: ({url, method, data, config, headers}) => {
config = config || {};
config.headers = headers || {};
if (data && data instanceof FormData) {
// config.headers = config.headers || {};
// config.headers['Content-Type'] = 'multipart/form-data';
@ -103,8 +106,6 @@ export default function(schema) {
!(data instanceof ArrayBuffer)
) {
data = JSON.stringify(data);
config = config || {};
config.headers = config.headers || {};
config.headers['Content-Type'] = 'application/json';
}