import brotli_enc "gopkg.in/kothar/brotli-go.v0/enc"
compressor := middleware.NewCompressor(5, "text/html")
compressor.SetEncoder("br", func(w http.ResponseWriter, level int) io.Writer {
params := brotli_enc.NewBrotliParams()
params.SetQuality(level)
return brotli_enc.NewBrotliWriter(params, w)
})
the above code shows error, but following seems working but compression not working what's wrong?
r := chi.NewRouter() //chi.NewMux()
//r.Use(middleware.Logger)
compressor := middleware.NewCompressor(5, "/*") //"/*"
compressor.SetEncoder("br", func(w io.Writer, level int) io.Writer {
params := brotli_enc.NewBrotliParams()
params.SetQuality(level)
return brotli_enc.NewBrotliWriter(params, w)
})
r.Use(compressor.Handler) //
the above code shows error, but following seems working but compression not working what's wrong?