How do I POST JSON data with cURL?

后端 未结 24 2920
刺人心
刺人心 2020-11-21 23:56

I use Ubuntu and installed cURL on it. I want to test my Spring REST application with cURL. I wrote my POST code at the Java side. However, I want to test it with cURL. I am

24条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 00:47

    This worked well for me.

    curl -X POST --data @json_out.txt http://localhost:8080/
    

    Where,

    -X Means the http verb.

    --data Means the data you want to send.

提交回复
热议问题