如何从终端向Spring Boot发送POST请求?

时间:2015-12-28 23:11:30

标签: bash http terminal

localhost:7090/someurl运行的Spring Boot服务接受Var1次请求中的参数Var2POST。如何从CentOS 7终端进行测试?

当我在网络浏览器中输入localhost:7090/someurl?Var1=something&Var2=anotherthing时,日志会显示已发出未报告的GET请求。如何模仿POST请求来测试此服务?我在CentOS 7终端上输入什么内容?

1 个答案:

答案 0 :(得分:2)

如果它是普通的bash shell,你总是可以使用curl(你可能需要安装它),例如:

curl -X POST -d "Var1=VALUE1&Var2=VALUE2" localhost:7090/someurl