http-echo-server

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2023 License: MIT

README

http-echo-server

Echo information about an HTTP request.

Overview

$ LISTEN_ADDR=:7070 ./http-echo-server 2>stderr 1>stdout &
[1] 4071874

$ curl -H "X-Header: badoop" http://localhost:7070/foo
GET /foo HTTP/1.1
Accept: */*
User-Agent: curl/7.86.0
X-Header: badoop


$ curl -H "X-Header: badoop" -X POST -d bar="baz" http://localhost:7070/foo
POST /foo HTTP/1.1
Accept: */*
Content-Length: 7
Content-Type: application/x-www-form-urlencoded
User-Agent: curl/7.86.0
X-Header: badoop

bar=baz%

$ cat stderr stdout
2023/02/02 11:00:30 starting http-echo-server on :7070
127.0.0.1 - - [02/Feb/2023:11:00:42 -0500] "GET /foo HTTP/1.1" 200 76
127.0.0.1 - - [02/Feb/2023:11:02:23 -0500] "POST /foo HTTP/1.1" 200 152

Install

Locally:

$ go install git.sr.ht/~jswank/http-echo-server

Via Docker:

$ docker run jswank/http-echo-server:latest

Development

Using casy/just:

$ just
Available recipes:
    build           # build the binary
    build-image     # build a docker image
    clean           # clean up
    clean-container # remove the container
    default         # list the just recipes
    run             # run the binary
    run-container   # run a container via docker-compose

License

MIT

Directories

Path Synopsis
cmd
server command
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL