相关疑难解决方法(0)

获取:发布json数据,application/json更改为text/plain

我使用的是chrome 53.0.2785.116 m(64位).

我在devtools上得到了以下标题.该问题标有"//"注释.内容类型真的不允许我们将它设置为application/json,我尝试了100种不同的方式.

import fetch from 'isomorphic-fetch';
const option = {
    method: 'POST',
    mode: 'no-cors',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({'aa':'bb'})
}
fetch('/books', opts)
.then(check401)
.then(check404)
.then(jsonParse)
.then(errorMessageParse);
Run Code Online (Sandbox Code Playgroud)

请求标题

accept:application/json
Accept-Encoding:gzip, deflate
Accept-Language:zh-CN,zh;q=0.8
Connection:keep-alive
Content-Length:97
content-type:text/plain;charset=UTF-8 //What happen?
Host:127.0.0.1:8989
Origin:http://127.0.0.1:8989
Referer:http://127.0.0.1:8989/
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36
Run Code Online (Sandbox Code Playgroud)

javascript google-chrome ecmascript-6

15
推荐指数
1
解决办法
9836
查看次数

标签 统计

ecmascript-6 ×1

google-chrome ×1

javascript ×1