grace icon indicating copy to clipboard operation
grace copied to clipboard

content-type设置不生效

Open CurryHan opened this issue 6 years ago • 4 comments

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

CurryHan avatar Sep 25 '18 08:09 CurryHan

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

:octocat: From gitme Android

wendux avatar Sep 27 '18 14:09 wendux

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 avatar Sep 29 '18 08:09 CurryHan

已修复,请更新重试

wendux avatar Oct 11 '18 09:10 wendux

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

CurryHan avatar Oct 11 '18 10:10 CurryHan