Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

网络请求无论怎么设置content-type总是text/plain #5015

Closed
nishibaiyang opened this issue Dec 5, 2019 · 6 comments
Closed

网络请求无论怎么设置content-type总是text/plain #5015

nishibaiyang opened this issue Dec 5, 2019 · 6 comments
Assignees

Comments

@nishibaiyang
Copy link

网络请求无论怎么设置content-type总是text/plain

复现步骤

let requestBody = {
            "kubiCost" : this.state.noPrice ? 0 : this.state.price,
            "tagIds" : arr
        };
        let header = new Headers();
        header.append('Accept','application/json,text/javascript,*/*');
        header.append('Content-Type', 'application/json;charset=utf-8');
        
        return fetch(host + url, {
            method: 'POST',
            credentials: 'include',
            body: JSON.stringify(requestBody),
            mode: 'no-cors',
            headers: header
        }).then(res => {
            return res.text();
        });

系统信息

Node: 8.15.0 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
npmPackages:
@tarojs/components: 1.3.27 => 1.3.27
@tarojs/plugin-babel: 1.3.27 => 1.3.27
@tarojs/plugin-csso: 1.3.27 => 1.3.27
@tarojs/plugin-sass: 1.3.27 => 1.3.27
@tarojs/plugin-uglifyjs: 1.3.27 => 1.3.27
@tarojs/rn-runner: 1.3.27 => 1.3.27
@tarojs/router: 1.3.27 => 1.3.27
@tarojs/taro: 1.3.27 => 1.3.27
@tarojs/taro-alipay: 1.3.27 => 1.3.27
@tarojs/taro-h5: 1.3.27 => 1.3.27
@tarojs/taro-swan: 1.3.27 => 1.3.27
@tarojs/taro-tt: 1.3.27 => 1.3.27
@tarojs/taro-weapp: 1.3.27 => 1.3.27
@tarojs/webpack-runner: 1.3.27 => 1.3.27
eslint-config-taro: 1.3.27 => 1.3.27
eslint-plugin-taro: 1.3.27 => 1.3.27
nerv-devtools: ^1.5.6 => 1.5.6
nervjs: ^1.5.6 => 1.5.6

@taro-bot
Copy link

taro-bot bot commented Dec 5, 2019

CC @Littly

@taro-bot
Copy link

taro-bot bot commented Dec 5, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@shenghanqin
Copy link
Collaborator

@nigelvon 稍微把fetch方法提供一下?

@taro-bot
Copy link

taro-bot bot commented Dec 6, 2019

Hello~

您的问题所提供的信息不足,我们无法定位到具体的问题。如果有空的话还请拔冗提供更具体的信息,否则这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

@nishibaiyang
Copy link
Author

@nigelvon 稍微把fetch方法提供一下?

fetch方法就是上面,用的就是页面里面最原始的的fetch

@yuanbolin
Copy link

同样遇到了,请问解决了吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants