distribution/vendor/github.com/gorilla/handlers
Sebastiaan van Stijn 4f9fe183c3
vendor: github.com/gorilla/handlers v1.5.2
full diff: https://github.com/gorilla/handlers/compare/v1.5.1...v1.5.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-22 10:23:09 +01:00
..
.editorconfig vendor: github.com/gorilla/handlers v1.5.2 2023-12-22 10:23:09 +01:00
.gitignore vendor: github.com/gorilla/handlers v1.5.2 2023-12-22 10:23:09 +01:00
canonical.go vendor: github.com/gorilla/handlers v1.5.2 2023-12-22 10:23:09 +01:00
compress.go vendor: github.com/gorilla/handlers v1.5.2 2023-12-22 10:23:09 +01:00
cors.go vendor: github.com/gorilla/handlers v1.5.2 2023-12-22 10:23:09 +01:00
doc.go Move to vendor 2016-03-22 10:45:49 -07:00
handlers.go vendor: github.com/gorilla/handlers v1.5.2 2023-12-22 10:23:09 +01:00
LICENSE vendor: github.com/gorilla/handlers v1.5.2 2023-12-22 10:23:09 +01:00
logging.go vendor: github.com/gorilla/handlers v1.5.2 2023-12-22 10:23:09 +01:00
Makefile vendor: github.com/gorilla/handlers v1.5.2 2023-12-22 10:23:09 +01:00
proxy_headers.go vendor: github.com/gorilla/handlers v1.5.2 2023-12-22 10:23:09 +01:00
README.md vendor: github.com/gorilla/handlers v1.5.2 2023-12-22 10:23:09 +01:00
recovery.go vendor: github.com/gorilla/handlers v1.5.2 2023-12-22 10:23:09 +01:00

gorilla/handlers

Testing Codecov GoDoc 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.