Skip to content

Commit

Permalink
snappy
Browse files Browse the repository at this point in the history
  • Loading branch information
iesreza committed Oct 20, 2022
1 parent 731cefb commit c6cbe99
Show file tree
Hide file tree
Showing 23 changed files with 2,102 additions and 1,373 deletions.
4 changes: 4 additions & 0 deletions fiber.context.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/getevo/evo/lib/log"
"github.com/getevo/evo/lib/text"
"github.com/gofiber/utils"
"github.com/klauspost/compress/snappy"
"github.com/valyala/fasthttp"
"io"
"mime/multipart"
Expand Down Expand Up @@ -479,6 +480,9 @@ func (r *Request) Write(body interface{}) {
if r.BeforeWrite != nil {
data = r.BeforeWrite(r, data)
}
if r.Header("x-snappy") == "1" {
data = snappy.Encode(nil, data)
}
r.Context.Context().Response.SetBody(data)
}

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ require (
github.com/gofiber/websocket v0.5.1
github.com/jackskj/carta v0.2.0
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
github.com/klauspost/compress v1.15.11
github.com/leodido/go-urn v1.2.1
github.com/lithammer/shortuuid v3.0.0+incompatible
github.com/magefile/mage v1.11.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQL
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.10.7 h1:7rix8v8GpI3ZBb0nSozFRgbtXKv+hOe+qfEpZqybrAg=
github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.15.11 h1:Lcadnb3RKGin4FYM/orgq0qde+nc15E5Cbqg4B9Sx9c=
github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
Expand Down
276 changes: 276 additions & 0 deletions vendor/github.com/klauspost/compress/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c6cbe99

Please sign in to comment.