This is a python http server that echoes any received request.
For the following HTTP request:
$ curl --header "Favorite-Color: Purple" \
--data "param1=value1¶m2=value2"\
http://localhost:8080/hello-mars
Server output:
$ python app.py
Echoing from http://localhost:8080
127.0.0.1 - Thu Mar 15 23:43:27 2018 - POST /hello-mars HTTP/1.1
Returned response:
POST /hello-mars HTTP/1.1
Host: localhost:3246
User-Agent: curl/7.54.0
Accept: */*
Favorite-Color: Purple
Content-Length: 27
Content-Type: application/x-www-form-urlencoded
param1=value1¶m2=value2
Run the application using Python 3.4+, no other dependencies are needed.
python ./app.py
Options:
-b BIND, --bind BIND host to bind to
-p PORT, --port PORT port to listen on
-q, --quiet do not print request body
Docker:
docker build -t echo-server .
docker run -itp 8080:8080 echo-server
Openshift
oc new-app centos/python-35-centos7~https://github.com/flerro/echo-server --name=httpecho
Image build with s2i
s2i build https://github.com/flerro/echo-server centos/python-35-centos7 httpecho
Forked from cdfuller/echo-server