fly icon indicating copy to clipboard operation
fly copied to clipboard

vue-cli使用flyio实现http请求返回的数据却是String类型?

Open bruce-zhang932 opened this issue 5 years ago • 2 comments

` //http.js import Fly from 'flyio/dist/npm/fly' import config from '@/config'

const request = new Fly()

request.config = { baseURL: config.host, parseJson:true }

function getAuth () { let headers = {} headers['Content-Type'] = 'application/json' return headers } //index.vue

let result = await Api.Data({}) console.log(result) console.log(typeof result) ` QQ截图20190628113025

第一行是发出的请求, 第二行返回的data是字符串,我明明请求是application/json,,不知道是什么原因?

bruce-zhang932 avatar Jun 30 '19 01:06 bruce-zhang932

我也出现这个问题,在ios上ok,在android就会出现这个。自己JSON.parse一下吧

leiyaguang avatar Dec 27 '19 16:12 leiyaguang

new的时候 { parseJson: true }

self-transition avatar Mar 04 '20 02:03 self-transition