Categorygithub.com/mo3m3n/http-echo
repositorypackage
1.0.0
Repository: https://github.com/mo3m3n/http-echo.git
Documentation: pkg.go.dev

# README

http-echo

A simple golang HTTP/S server that echoes back request attributes to the client in JSON formats.
By default the certificate CN is the hostname of the machine where the program is running.

How to use

docker run -p 8888:80 -p 8443:443 --rm -t mo3m3n/http-echo

Output example

curl -b "test=bar" -k https://localhost:8443/path\?a\=foo1\&b\=foo2
{
  "http": {
    "cookies": [
      "test=bar"
    ],
    "headers": {
      "Accept": "*/*",
      "Cookie": "test=bar",
      "User-Agent": "curl/7.70.0"
    },
    "host": "localhost:8443",
    "method": "GET",
    "path": "/path",
    "protocol": "HTTP/2.0",
    "query": "a=foo1\u0026b=foo2",
    "raw": "GET /path?a=foo1\u0026b=foo2 HTTP/1.1\r\nHost: localhost:8443\r\nUser-Agent: curl/7.70.0\r\nAccept: */*\r\nCookie: test=bar\r\n\r\n"
  },
  "os": {
    "hostname": "traktour"
  },
  "tcp": {
    "ip": "[::1]",
    "port": "53364"
  },
  "tls": {
    "cipher": "TLS_AES_128_GCM_SHA256",
    "sni": "localhost"
  }
}

Credits

mendhak/docker-http-https-echo