mirror of
https://gitlab.com/commento/commento.git
synced 2025-06-29 22:56:37 -04:00
api: allow gzipped response
This commit is contained in:
18
api/utils_gzip.go
Normal file
18
api/utils_gzip.go
Normal file
@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
)
|
||||
|
||||
func gzipStatic(b []byte) ([]byte, error) {
|
||||
var buf bytes.Buffer
|
||||
g := gzip.NewWriter(&buf)
|
||||
if _, err := g.Write(b); err != nil {
|
||||
g.Close()
|
||||
return []byte{}, err
|
||||
}
|
||||
|
||||
g.Close()
|
||||
return buf.Bytes(), nil
|
||||
}
|
Reference in New Issue
Block a user