使用curl命令执行get请求,带多个参数:

1 curl localhost:8080/user/binding/query?userId=123456&wrapperId=123&from=test  
2 [1] 8937  
3 [2] 8938  
4 {"ver":"1.0.0","status":1,"message":"Required String parameter 'wrapperId' is not present","data":null,"ok":false}  
5 [1]-  Done                    curl localhost:8080/user/binding/query?userId=123456  
6 [2]+  Done                    wrapperId=123  

返回结果提示缺少参数wrapperId,但是上述url中的确有wrapperId。

 

看最后两行的结果,发现是url被&号截开,在shell中被当做两条命令来执行的。

 

解决方案

在url外面加上引号:

1 curl "localhost:8080/user/binding/query?userId=123456&wrapperId=123&from=test"

 

相关文章:

  • 2021-11-16
  • 2021-11-10
猜你喜欢
  • 2021-08-15
  • 2021-06-24
  • 2022-12-23
  • 2021-11-12
  • 2021-06-27
  • 2021-04-17
  • 2021-09-25
相关资源
相似解决方案