wx.request的入参是不是不能是json对象
发布于 5 年前 作者 mengyang 14458 次浏览 来自 问答
var student = new Object();
           student.name = "Lanny";
           student.age = "25";
           student.location = "China";
           wx.request({
             // 调用接口
             url: 'http://localhost:8080/visisys1/abc/addCode',
             method: 'GET',
             data: {
               data: "abc",
               otherinfo: student
             },
 
             success(resp) {      
               console.log("res******************", resp.data);            
             }
           })

当入参的data:{otherInfo: student},如果otherInfo是json对象时,后台入参也是json格式的,但是会报argument type mismatch的错误。

后台代码:

报错信息:

2 回复

一脸懵逼,请稍微多给点提示,谢谢

应该叫做request  payload, server input接收即可

回到顶部