http-echo-server

module
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MIT

README

http-echo-server

Echo information about an HTTP request.

Overview

$ HES_ADDRESS=:7070 bin/server 2>stderr 1>stdout &
[1] 4071874

$ curl -H "X-Header: bar" -X OPTIONS http://localhost:7070/foo                                  [09:33:46]
OPTIONS /foo HTTP/1.1
Accept: */*
User-Agent: curl/7.86.0
X-Header: bar


$ 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:

$ GOBIN=/path/to/bin go install git.sr.ht/~jswank/http-echo-server/cmd/http-echo-server

Via Docker:

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

Development

Using casy/just:

$ just -l
Available recipes:
    all             # compile and run
    build-image     # build a docker image
    clean           # remove server binary + container
    clean-container # remove the container
    clean-server
    compile
    compile-server
    run
    run-container   # run a container via docker-compose
    run-server

License

MIT

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

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