one liner accept all http server
netcat is swiss-army knife for TCP/IP, following command creates a http server, which can accept all requests with any http verb or paths and return 200 OK.
while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; echo foo; } | nc -l 80; done
testing:
curl -XPOST http://127.0.0.1/foo/bar
helpful for stubbing external http service in need.
Written by sumit gupta
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#