emulateJSON

本文共--字 阅读约--分钟 | 浏览: -- Last Updated: 2021-07-03

如果Web服务器无法处理编码为application/json的请求,你可以启用emulateJSON选项。

启用该选项后,请求会以application/x-www-form-urlencoded作为Content-Type,就像普通的HTML表单一样。

Vue.http.options.emulateJSON = true;

request.headers.set('Content-Type', 'application/x-www-form-urlencoded')

对应

Vue.http.options.emulateJSON = false;

request.headers.set('Content-Type', 'application/json')