cURL

Quick Tip: Sending Newlines with cURL

Yikes, this took far too long to figure out! I have a service which takes plain text multi-line input and outputs an object for each line, something like this: Input Line 1 Line 2 Line 3 Output [ {line: "Line 1"}, {line: "Line 2"}, {line: "Line 3"} ] There’s a bit more to it than that, but that’s the gist. I want to test my service with cURL, trying: curl --data "Line 1\nLine 2\nLine 3" \ -H "Content-Type: text/plain" localhost:3000/parse This did not work.
Read more