func NewGzipResponseWriterLevel(w http.ResponseWriter, r *http.Request, level int) (*GzipResponseWriter, error) {
	gzw := new(GzipResponseWriter)
	gzw.w = w
	if Gzip(w, r) {
		w.Header().Set("Content-Encoding", "gzip")
		g, err := gzip.NewWriterLevel(w, level)
		if err != nil {
			return nil, err
		}
		gzw.g = g
	}
	return gzw, nil
}
NewGzipResponseWriterLevel takes a request and response writer and forms
a GzipResponseWriter using the given compression level if using GZIP.
package web
import (
	"compress/gzip"
	"github.com/SlyMarbo/spdy"
	"net/http"
	"strings"
)
func Gzip(w http.ResponseWriter, r *http.Request) bool {
	return spdy.UsingSPDY(w) || strings.Contains(r.Header.Get("Accept-Encoding"), "gzip")
}
type GzipResponseWriter struct {
	w http.ResponseWriter
	g *gzip.Writer
}
func NewGzipResponseWriter(w http.ResponseWriter, r *http.Request) *GzipResponseWriter {
	gzw := new(GzipResponseWriter)
	gzw.w = w
	if Gzip(w, r) {
		w.Header().Set("Content-Encoding", "gzip")
		gzw.g = gzip.NewWriter(w)
	}
	return gzw
}