No description, website, or topics provided.
Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
_thirdparty
reports
testing
.gitignore
.travis.yml
README.md
const.go
self_test.go
test_close_notifier.go
test_context_go11.go
test_context_go18.go
test_flusher.go
test_hijacker.go
test_proto.go
test_pusher_go11.go
test_pusher_go18.go
test_reader_from.go
test_string_writer.go
test_tls.go
tests.go
tests_go11.go
tests_go17.go
util.go
util_go11.go
util_go16.go

README.md

Build Status GoDoc

Finding high quality net/http middleware is hard. Middleware get outdated, have only partial support or fail to comply with basic net/http semantics in other ways. The httpmiddlewarevet project aims to provide developers with a clearer picture of which handlers are good net/http citizens and which are not.

Results

Checkout middleware.vet to see the latest test results.

HTTP Middleware Vet

Validate Middleware Handlers with Vet

Many http.Handler wrappers (e.g. middleware) do not implement all necessary interfaces or respect the basic semantics of those interfaces. Vet provides a tool to test these handlers.

example :

package main

import (
	"net/http"
	"testing"

	"github.com/fd/httpmiddlewarevet"
)

func Test(t *testing.T) {
	httpmiddlewarevet.Vet(t, func(h http.Handler) http.Handler {
		return MyMiddleware(h) // replace MyMiddleware with your http.Handler
	})
}

What is tested for

  • http.Flusher
    • go1.x: interface compliance
  • http.Hijacker
    • go1.x: interface compliance
  • http.CloseNotifier
    • go1.x: interface compliance
    • go1.x: semantics
  • io.ReaderFrom
    • go1.x: interface compliance
  • http.Pusher
    • go1.8+: interface compliance
  • http.Request.Context
    • go1.x: absent
    • go1.8+: Done() semantics

This list is expected to grow over time. Contributions are welcome.

Which versions of Go are tested

The last stable release and the two previous minor releases as well as tip are tested. So if go1.7 is the latest stable release go1.7, go1.6, go1.5 and go1.8-pre are tested. This gives any middleware maintainers the leeway to guarantee stable && stable-1 stability.