You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Corey Daley 25a1b1c267
Delete .circleci directory
1 year ago
.github Create release-drafter.yml (#163) 6 years ago
LICENSE
README.md Update README.md 2 years ago
canonical.go Keep query string when redirecting to CanoncialHost 9 years ago
canonical_test.go Keep query string when redirecting to CanoncialHost 9 years ago
compress.go Fix compression of *os.Files. (#197) 4 years ago
compress_test.go Fix compression of *os.Files. (#197) 4 years ago
cors.go [cors] add OPTIONS status code + fix function typo (#132) 6 years ago
cors_test.go Use got-want style so mutation test can be performed easily with correct output (#184) 4 years ago
doc.go
go.mod Use httpsnoop to wrap ResponseWriter. (#193) 4 years ago
go.sum Use httpsnoop to wrap ResponseWriter. (#193) 4 years ago
handlers.go Use httpsnoop to wrap ResponseWriter. (#193) 4 years ago
handlers_go18_test.go Use httpsnoop to wrap ResponseWriter. (#193) 4 years ago
handlers_test.go added ability to register custom log formatter (#131) 7 years ago
logging.go Use httpsnoop to wrap ResponseWriter. (#193) 4 years ago
logging_test.go Use httpsnoop to wrap ResponseWriter. (#193) 4 years ago
proxy_headers.go docs: ProxyHeaders: mention X-Forwarded-Host in the docs (#165) 6 years ago
proxy_headers_test.go Fix formatting & go vet issues (#162) 6 years ago
recovery.go Support logger for print stack trace (#195) 4 years ago
recovery_test.go Support logger for print stack trace (#195) 4 years ago

README.md

gorilla/handlers

GoDoc CircleCI Sourcegraph

Package handlers is a collection of handlers (aka "HTTP middleware") for use with Go's net/http package (or any framework supporting http.Handler), including:

Other handlers are documented on the Gorilla website.

Example

A simple example using handlers.LoggingHandler and handlers.CompressHandler:

import (
    "net/http"
    "github.com/gorilla/handlers"
)

func main() {
    r := http.NewServeMux()

    // Only log requests to our admin dashboard to stdout
    r.Handle("/admin", handlers.LoggingHandler(os.Stdout, http.HandlerFunc(ShowAdminDashboard)))
    r.HandleFunc("/", ShowIndex)

    // Wrap our server with our gzip handler to gzip compress all responses.
    http.ListenAndServe(":8000", handlers.CompressHandler(r))
}

License

BSD licensed. See the included LICENSE file for details.