Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP test server: print all client requests to stdout

I need simple web server for debugging my application (Arduino web client, curl, etc.).

What is my idea:

I run command like

curl -X POST -H "Content-Type: application/json" \
  -H "Accept: application/json" -d '{"address":"192.168.200.3", \
  "title":"Abc" }' http://SERVER/xyz

to test webserver running at http://SERVER:80. This webserver write data + all http headers to standard terminal output.

It will be great for testing Arduino with Ethernet shield.

Is there any exiting product (for Linux)? I can write it in Java, but I do not want to reinvent the wheel...

like image 462
martin Avatar asked Oct 12 '14 20:10

martin


1 Answers

I always use nc (netcat) for this, in a style like:

nc -l -p 8080

It isn't really a "HTTP server" but only a dumb TCP server, but if you're mostly interested in seeing the client request and not necessarily serving back a proper HTTP response then it is good enough.

like image 94
Daniel Stenberg Avatar answered Sep 27 '22 21:09

Daniel Stenberg