code: func wantsCompressedResponse(req *http.Request) (bool, string) {
  	// don't compress watches
  	ctx := req.Context()
  	info, ok := request.RequestInfoFrom(ctx)
  	if !ok {
  		return false, ""
  	}
  	if !info.IsResourceRequest {
  		return false, ""
  	}
  	if info.Verb == "watch" {
  		return false, ""
  	}
  	header := req.Header.Get(headerAcceptEncoding)
  	gi := strings.Index(header, encodingGzip)
  	zi := strings.Index(header, encodingDeflate)
  	// use in order of appearance
  	switch {
  	case gi == -1:
  		return zi != -1, encodingDeflate
  	case zi == -1:
  		return gi != -1, encodingGzip
  	case gi < zi:
  		return true, encodingGzip
  	default:
  		return true, encodingDeflate
  	}
  }
docs: // wantsCompressedResponse reads the Accept-Encoding header to see if and which encoding is requested.