How to pass "Content-Length" value in header using Curl Command
Try this: curl -X POST http://localhost:9090/pro/v1/files -d "Content-Length: 0"
curl
's -d
flag allows you to add data to the body of the request. According to its docs:
-d, --data (HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and presses the submit button. This will cause curl to pass the data to the server using the content-type application/x-www-form-urlencoded.
Adding headers like this should do the trick:
-H 'content-length: 1000' \
You can use -d ""
causes CURL to send a Content-Length: 0
,
see Header 'Content-Length: 0' is missing when I do curl -X POST $URI