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设置不生效 #31

Open
CurryHan opened this issue Sep 25, 2018 · 4 comments
Open

content-type设置不生效 #31

CurryHan opened this issue Sep 25, 2018 · 4 comments

Comments

@CurryHan
Copy link

this.$http.post(api.editBuyCommodity,{
      Price: 1.1,
      Deposit: 1.1,
      CategoryID: 1,
      Quantity: 1,
      Quality: 9,
      Picture: '11'
    },{
        headers:{
          'Content-Type': 'application/json'
        }
    })

image

@wendux
Copy link
Owner

wendux commented Sep 27, 2018

默认就是json, 我看看你全局配置

:octocat: From gitme Android

@CurryHan
Copy link
Author

CurryHan commented Sep 29, 2018

grace.http.interceptors.request.use((request) => {
  var token = wx.getStorageSync('token') || ""
  if (token === "") return wx.navigateTo({
    url: '/pages/authorize/index',
  })

  request.headers = { 'Authorization': 'Bearer ' + token, 'Content-Type':'application/json' }
  console.log("interceptors.request", request);
  request.body = JSON.stringify(request.body)
  return request;
});

为了用json 我只好在全局里加了配置 才可以

@CurryHan CurryHan changed the title cotent-type设置不生效 content-type设置不生效 Oct 9, 2018
@wendux
Copy link
Owner

wendux commented Oct 11, 2018

已修复,请更新重试

@CurryHan
Copy link
Author

改了啥 我试了还不行
我请求的是post

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

2 participants