github.com/rkusa/http-assert

Simplified error handling for http routes using assert with status code


License
MIT
Install
go get github.com/rkusa/http-assert

Documentation

assert

Simplified error handling for http routes using assert with status code that works well (but not exclusively) with rkusa/web.

Build Status GoDoc

Example

Middleware usage

app := web.New()
app.Use(assert.Middleware())

Asserting

assert.OK(username != "", 400, "No username given")
assert.Error(err)
assert.Success(err, 400, "something failed")

License

MIT