Reputation: 10641
I want to use cURL to test a RESTful web service resource.
In that effort, one of the headers requires a linebreak to properly pass the data to the server.
In addition to endlessly searching for what I would think would be fairly common to no avail, I have tried using (\n):
curl -X POST --header "login_id: testUser" --header "passcode: testPasscode" --header "dataHeader: some data\nsome more data" http://localhost:8080/api/test
which does not work. The line break is not recognized when the header is read at the server - I think cURL actually removes it.
I have also tried using (%0A):
curl -X POST --header "login_id: testUser" --header "passcode: testPasscode" --header "dataHeader: some data%0Asome more data" http://localhost:8080/api/test
How should I craft the post to insert a line break between some data
and some more data
?
I am using terminal on a Mac
Upvotes: 1
Views: 3786
Reputation: 10337
Try passing a raw line break from the command line:
$ curl -X POST [...] --header "dataHeader: some data<press ENTER>
> some more data" http://localhost:8080/api/test
Upvotes: 1