我正在尝试通过命令行向我的api发出curl get请求。
curl http://localhost:8080/getList?id=100&mrp=50&discount=0
但是当我在api中记录请求时,我得到了:
&{GET /getList?id=100 HTTP/1.1 1 1 which means that only id is being sent through the request. I don't understand why it is happening.
答案 0 :(得分:3)
当您运行curl命令时,多个请求参数由&
分隔,unix会将&
视为符号,以便在后台执行上一个命令。其后跟随它的其他命令将被视为单独的命令
在发送请求时将引号包裹在引号中
curl "http://localhost:8080/getList?id=100&mrp=50&discount=0"