Documentation ¶
Overview ¶
Package compress provides a clever gzip compressing handler.
Example ¶
package main import ( "fmt" "net/http" "github.com/gowww/compress" ) func main() { mux := http.NewServeMux() mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Hello") }) http.ListenAndServe(":8080", compress.Handle(mux)) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handle ¶
Handle returns a Handler wrapping another http.Handler.
Example ¶
package main import ( "fmt" "net/http" "github.com/gowww/compress" ) func main() { mux := http.NewServeMux() mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Hello") }) http.ListenAndServe(":8080", compress.Handle(mux)) }
Output:
func HandleFunc ¶
func HandleFunc(f http.HandlerFunc) http.Handler
HandleFunc returns a Handler wrapping an http.HandlerFunc.
Example ¶
package main import ( "fmt" "net/http" "github.com/gowww/compress" ) func main() { http.Handle("/", compress.HandleFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Hello") })) http.ListenAndServe(":8080", nil) }
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.