1 min read

How to see what curl is sending without a server

Etienne Marais

Being part of an awesome developer community is probably the one thing that keeps me learning more and more every day.

I am thankful for being part of ZATech on Slack and I get to learn and see a great deal of cool things.

nc

Today I saw how to see what data gets sent via curl without having to setup a server to log output from.

nc -l 7777 & curl -X POST --data-binary 'yolo' localhost:7777

# Outputs
[1] 6230
POST / HTTP/1.1
Host: localhost:7777
User-Agent: curl/7.43.0
Accept: */*
Content-Length: 4
Content-Type: application/x-www-form-urlencoded

yolo

Caveat on linux

The top command works for mac. If you are running linux you need to add the -p flag.

nc -l -p 7777 & curl -X POST --data-binary 'yolo' localhost:7777

Credit

Credit: https://twitter.com/jponelat/status/951396262061969409 Credit: @jponelat