https://github.com/sgreben/http-echo
tiny HTTP server that echoes the requests it receives. single binary, no dependencies. linux, osx, windows.
https://github.com/sgreben/http-echo
debug echo golang http http-server tiny
Last synced: 12 months ago
JSON representation
tiny HTTP server that echoes the requests it receives. single binary, no dependencies. linux, osx, windows.
- Host: GitHub
- URL: https://github.com/sgreben/http-echo
- Owner: sgreben
- Created: 2018-11-13T21:06:38.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-05-04T22:59:03.000Z (almost 6 years ago)
- Last Synced: 2025-02-07T14:40:17.646Z (about 1 year ago)
- Topics: debug, echo, golang, http, http-server, tiny
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# http-echo
`http-echo` is a dependency-free HTTP server that always responds with the request it receives.
## Contents
- [Contents](#contents)
- [Examples](#examples)
- [Get it](#get-it)
- [Using `go get`](#using-go-get)
- [Pre-built binary](#pre-built-binary)
- [Use it](#use-it)
## Examples
```sh
$ http-echo
2018/11/13 20:58:13.542893 http-echo listening on ":8080", responding with HTTP 200 (OK)
```
```sh
$ http-echo -p 1234
2018/11/13 20:57:45.561703 http-echo listening on ":1234", responding with HTTP 200 (OK)
```
```sh
$ export PORT=9999
$ http-echo
2018/11/13 21:00:45.927216 http-echo listening on ":9999", responding with HTTP 200 (OK)
```
## Get it
### Using `go get`
```sh
go get -u github.com/sgreben/http-echo
```
### Pre-built binary
Or [download a binary](https://github.com/sgreben/http-echo/releases/latest) from the releases page, or from the shell:
```sh
# Linux
curl -L https://github.com/sgreben/http-echo/releases/download/1.0.1/http-echo_1.0.1_linux_x86_64.tar.gz | tar xz
# OS X
curl -L https://github.com/sgreben/http-echo/releases/download/1.0.1/http-echo_1.0.1_osx_x86_64.tar.gz | tar xz
# Windows
curl -LO https://github.com/sgreben/http-echo/releases/download/1.0.1/http-echo_1.0.1_windows_x86_64.zip
unzip versions_1.0.1_windows_x86_64.zip
```
## Use it
```text
Usage of http-echo:
-a string
(alias for -addr) (default ":8080")
-addr string
address to listen on (environment variable "ADDR") (default ":8080")
-http-status int
use this HTTP status for responses (environment variable "HTTP_STATUS") (default 200)
-p int
(alias for -port)
-port int
port to listen on (overrides -addr port) (environment variable "PORT")
-q (alias for -quiet)
-quiet
disable all log output (environment variable "QUIET")
```