Skip to content
Snippets Groups Projects
Select Git revision
  • main default protected
  • drip-server-timing
  • compress-middleware
  • v2.11.0
  • v2.10.0
  • v2.9.2
  • v2.9.1
  • v2.9.0
  • v2.8.0
  • v2.7.0
  • v2.6.0
  • v2.5.6
  • v2.5.5
  • v2.5.4
  • v2.5.3
  • v2.5.2
  • v2.5.1
  • v2.5.0
  • v2.4.2
  • v2.4.1
  • v2.4.0
  • v2.3.0
  • v2.2.2
23 results

go-httpbin

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Will McCutchen authored
    a4831155
    History

    go-httpbin

    A reasonably complete and well-tested golang port of Kenneth Reitz's httpbin service, with zero dependencies outside the go stdlib.

    GoDoc Build Status Coverage

    Usage

    Run as a standalone binary, configured by command line flags or environment variables:

    $ go-httpbin -help
    Usage of ./dist/go-httpbin:
      -max-duration duration
            Maximum duration a response may take (default 10s)
      -max-memory int
            Maximum size of request or response, in bytes (default 1048576)
      -port int
            Port to listen on (default 8080)

    Docker images are published to Docker Hub:

    $ docker run -P mccutchen/go-httpbin

    Installation

    go get github.com/mccutchen/go-httpbin/...

    Inspiration & prior art

    I've been a longtime user of Kenneith Reitz's original httpbin.org, and wanted to write a golang port for fun and to see how far I could get using only the stdlib.

    When I started this project, there were a handful of existing and incomplete golang ports, with the most promising being ahmetb/go-httpbin. This project showed me how useful it might be to have an httpbin library available for testing golang applications.

    Known differences from other httpbin versions

    Compared to the original:

    • No /brotli endpoint (due to lack of support in Go's stdlib)
    • Response values which may be encoded as either a string or a list of strings will always be encoded as a list of strings (e.g. request headers, query params, form values)

    Compared to ahmetb/go-httpbin:

    • No dependencies on 3rd party packages
    • More complete implementation of endpoints

    Development

    # local development
    make
    make test
    make testcover
    make run
    
    # building & pushing docker images
    make image
    make imagepush