网站怎样制作 优帮云,如何建造网站,微平台推广,石家庄seo排名外包在利用axios从网络接收请求时#xff0c;发现返回obj的code为“-1”#xff0c;非常不解#xff0c;利用console.log测试#xff0c;更加不解#xff0c;可知抛出错误是 “ E 其他错误: userName required”。但是我在测试时#xff0c;它并没有体现为空#xff0c;…在利用axios从网络接收请求时发现返回obj的code为“-1”非常不解利用console.log测试更加不解可知抛出错误是 “ E 其他错误: userName required”。但是我在测试时它并没有体现为空
if (!data.useName) {console.error(userName 为空或未提供);throw new Error(userName 为空或未提供);}
为此我在多处测试日志如下 I 返回参数 {useName:18070538251,passWord:040726}
01-05 17:50:20.519 33064-28552 A0c0d0/JSAPP I http
01-05 17:50:20.520 33064-28552 A0c0d0/JSAPP I request {transitional:{silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false},adapter:[ohos],transformRequest:[null],transformResponse:[null],timeout:0,xsrfCookieName:XSRF-TOKEN,xsrfHeaderName:X-XSRF-TOKEN,maxContentLength:-1,maxBodyLength:-1,env:{Blob:null},headers:{Accept:application/json, text/plain, */*,Terminal:h5,h-token:},baseURL:http://159.75.169.224:3321/v3pz,url:/login,method:post,data:{useName:18070538251,passWord:040726}}
01-05 17:50:20.520 33064-28552 A02230/[axios] D : http url:http://159.75.169.224:3321/v3pz/login, options: {method:POST,header:{Accept:application/json, text/plain, */*,Content-Type:application/json,Terminal:h5,h-token:},readTimeout:0,maxLimit:-1,extraData:{\useName\:\18070538251\,\passWord\:\040726\}}
01-05 17:50:20.613 33064-28552 A0c0d0/JSAPP I code -1
01-05 17:50:20.614 33064-28552 A0c0d0/JSAPP I 输入obj: {code:-1,message:userName required,data:null}
01-05 17:50:20.614 33064-28552 A0c0d0/JSAPP E 其他错误: userName required仍然不解先记录后续后思路再回来解答。 很明显我的字段名错了。。。 利用postman调试时终于又认真认真看了一遍难绷哈。之前还在想是不是后端数据没掉了。但说真的我的debug能力还是要增强关于网络部分我也不是很熟悉。哎。 但还是恭喜我吧哈哈哈。
Day03陪诊。