错误请求错误:使用axios put在React js中出现400

问题描述 投票:0回答:2

[我正在仪表板上使用React,但是当我尝试PUT请求时,响应为错误400或401。

消息是:{"code":"missing_params","message":"Your update call does not have any parameter. Atleast one parameter is required."}

但是我在请求中插入了参数,我不明白我在做什么错。

uptdate()
{

var url="https://icgaid.freshdesk.com/api/v2/tickets/65"

    axios(url,{method:'put',headers: { 'authorization':'Basic ZHBhbG1hQGljZy5jb20uZ3Q6Z3VhdGU1MDI==','Content-Type':'application/json'},body:{'status':4}}
     ).then(response => response.json()).then(json => {console.log(json);this.setState({re:json})
    })
  }

`

javascript
2个回答
2
投票

对象应该有一个名为data的成员,您有主体,还应该检查API文档,也许您有错字,参数名称可能是错误的。

© www.soinside.com 2019 - 2024. All rights reserved.