DEV Community

Discussion on: How to Easily use cURL for HTTP Requests

Collapse
 
pbnj profile image
Peter Benjamin (they/them) • Edited

Nice introduction to cURL!
Tiny nitpick: you can wrap your payload (i.e. -d) in single quotes to avoid having to escape inner double quotes.
Example:

$ curl -H “Content-Type: application/json“ -d{ “value”: “node.js” }’ https://localhost:3000/test
Collapse
 
adityasridhar profile image
Aditya Sridhar

Thank you :)

Actually I tried single quotes initially. Works well in mac, but in windows it threw an error. So switched it back to double quotes :D

Collapse
 
pbnj profile image
Peter Benjamin (they/them)

Huh, didn't know that.
Thanks for the info.