Skip to content

darkhelmet/webutil

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

webutil

Little web utilities for Go

GzipHandler

Wraps a http.Handler to gzip things.

var handler http.Handler = buildHandler()
handler = webutil.GzipHandler{handler}
http.Handle("/", handler)

LogHandler

Basic request logging.

var handler http.Handler = buildHandler()
logger := log.New(...)
handler = webutil.LogHandler{handler, logger}
http.Handle("/", handler)

CanonicalHostHandler

301 redirects back to the canonical host.

var handler http.Handler = buildHandler()
handler = webutil.CanonicalHostHandler{handler, "wayneenterprises.com", "http"}
http.Handle("/", handler)

EnsureRequestBodyClosedHandler

Always close the request body.

var handler http.Handler = buildHandler()
handler = webutil.EnsureRequestBodyClosedHandler{handler}
http.Handle("/", handler)

AlwaysHeaderHandler

Always send these headers

var handler http.Handler = buildHandler()
handler = webutil.AlwaysHeaderHandler{handler, http.Header{"Vary": {"Accept-Encoding"}}}
http.Handle("/", handler)    

About

Little web utilities for Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages