How to post raw body data with curl?

前端 未结 1 1925
青春惊慌失措
青春惊慌失措 2020-12-13 01:54

Before you post this as a duplicate; I\'ve tried many of the suggestions I found around SO.

So far I\'ve been using postman to post data to a Java web service. That

相关标签:
1条回答
  • 2020-12-13 02:28

    curl's --data will by default send Content-Type: application/x-www-form-urlencoded in the request header. However, when using Postman's raw body mode, Postman sends Content-Type: text/plain in the request header.

    So to achieve the same thing as Postman, specify -H "Content-Type: text/plain" for curl:

    curl -X POST -H "Content-Type: text/plain" --data "this is raw data" http://78.41.xx.xx:7778/
    

    Note that if you want to watch the full request sent by Postman, you can enable debugging for packed app. Check this link for all instructions. Then you can inspect the app (right-click in Postman) and view all requests sent from Postman in the network tab :

    0 讨论(0)
提交回复
热议问题