(req *http.Request, writer http.ResponseWriter, htmlContent []byte)
| 920 | } |
| 921 | |
| 922 | func (this *CaptchaValidator) compressWrite(req *http.Request, writer http.ResponseWriter, htmlContent []byte) { |
| 923 | var acceptEncoding = req.Header.Get("Accept-Encoding") |
| 924 | if strings.Contains(acceptEncoding, "gzip") { |
| 925 | this.compressGzip(writer, htmlContent) |
| 926 | } else if strings.Contains(acceptEncoding, "br") { |
| 927 | this.compressBR(writer, htmlContent) |
| 928 | } else { |
| 929 | writer.Header().Set("Content-Length", types.String(len(htmlContent))) |
| 930 | writer.WriteHeader(http.StatusOK) |
| 931 | _, _ = writer.Write(htmlContent) |
| 932 | } |
| 933 | } |
| 934 | |
| 935 | func (this *CaptchaValidator) compressBR(writer http.ResponseWriter, htmlContent []byte) { |
| 936 | compressWriter, err := compressions.NewBrotliWriter(writer, 0) |
no test coverage detected