server.go
func CompressHandlerLevel(h RequestHandler, level int) RequestHandler {
	return func(ctx *RequestCtx) {
		h(ctx)
		if ctx.Request.Header.HasAcceptEncodingBytes(strGzip) {
			ctx.Response.gzipBody(level)
		} else if ctx.Request.Header.HasAcceptEncodingBytes(strDeflate) {
			ctx.Response.deflateBody(level)
		}
	}
}
func CompressHandlerLevel(h RequestHandler, level int) RequestHandler {
	return func(ctx *RequestCtx) {
		h(ctx)
		if ctx.Request.Header.HasAcceptEncodingBytes(strGzip) {
			ctx.Response.gzipBody(level)
		} else if ctx.Request.Header.HasAcceptEncodingBytes(strDeflate) {
			ctx.Response.deflateBody(level)
		}
	}
}
func CompressHandlerLevel ( h RequestHandler , level int ) RequestHandler { return func ( ctx * RequestCtx ) { h ( ctx ) if ctx . Request . Header . HasAcceptEncodingBytes ( strGzip ) { ctx . Response . gzipBody ( level ) } else if ctx . Request . Header . HasAcceptEncodingBytes ( strDeflate ) { ctx . Response . deflateBody ( level ) } } }
// CompressHandlerLevel returns RequestHandler that transparently compresses
// response body generated by h if the request contains 'gzip' or 'deflate'
// 'Accept-Encoding' header.
//
// Level is the desired compression level:
//
//     * CompressNoCompression
//     * CompressBestSpeed
//     * CompressBestCompression
//     * CompressDefaultCompression
//     * CompressHuffmanOnly
CompressHandlerLevel returns RequestHandler that transparently compresses response body generated by h if the request contains gzip or deflate Accept - Encoding header . Level is the desired compression level : * CompressNoCompression * CompressBestSpeed * CompressBestCompression * CompressDefaultCompression * CompressHuffmanOnly