Sign inSign up

maze88/echo-server

By maze88

Updated over 1 year ago

A simple Python/Flask based webserver that echos back any incoming requests.

Image
0

261

maze88/echo-server repository overview

Echo Server

A simple Python/Flask based webserver that echos back any incoming requests.

Build

docker build -t echo-server:latest .

Configuration (Environment variables)

Variable nameDefault valueDescription
BIND_ADDRESS0.0.0.0Which host address to listen on.
OUTPUTjsonThe format to return HTTP responses. Can be JSON or YAML.

Run

docker run --rm -d -p 5000:5000 echo-server:latest

Example query

curl -X POST 'http://localhost:5000/some/path/test?my_key=a_value&foo=bar' -d 'hello world' | jq

Should return:

{
  "args": {
    "foo": "bar",
    "my_key": "a_value"
  },
  "client_ip": "172.17.0.1",
  "data": "hello world",
  "headers": {
    "Accept": "*/*",
    "Content-Length": "11",
    "Content-Type": "application/x-www-form-urlencoded",
    "Host": "localhost:5000",
    "User-Agent": "curl/7.74.0"
  },
  "method": "POST",
  "response_time": 0.0002567768096923828,
  "timestamp": "2023-04-10 09:45:49.595615",
  "uri": "/some/path/test"
}

Tag summary

Content type

Image

Digest

sha256:2513b85bd

Size

22.3 MB

Last updated

over 1 year ago

docker pull maze88/echo-server