mirror of
1
Fork 0
gotosocial/vendor/github.com/gorilla/handlers
tobi fd8a724e77
[chore] Bump go swagger (#2871)
* bump go swagger version

* bump swagger version
2024-04-26 11:31:10 +02:00
..
.editorconfig [chore] Bump go swagger (#2871) 2024-04-26 11:31:10 +02:00
.gitignore [chore] Bump go swagger (#2871) 2024-04-26 11:31:10 +02:00
LICENSE [chore] Bump go swagger (#2871) 2024-04-26 11:31:10 +02:00
Makefile [chore] Bump go swagger (#2871) 2024-04-26 11:31:10 +02:00
README.md [chore] Bump go swagger (#2871) 2024-04-26 11:31:10 +02:00
canonical.go [chore] Bump go swagger (#2871) 2024-04-26 11:31:10 +02:00
compress.go [chore] Bump go swagger (#2871) 2024-04-26 11:31:10 +02:00
cors.go [chore] Bump go swagger (#2871) 2024-04-26 11:31:10 +02:00
doc.go [bugfix] Fix Swagger spec and add test script (#2698) 2024-03-06 18:05:45 +01:00
handlers.go [chore] Bump go swagger (#2871) 2024-04-26 11:31:10 +02:00
logging.go [chore] Bump go swagger (#2871) 2024-04-26 11:31:10 +02:00
proxy_headers.go [chore] Bump go swagger (#2871) 2024-04-26 11:31:10 +02:00
recovery.go [chore] Bump go swagger (#2871) 2024-04-26 11:31:10 +02:00

README.md

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.