Skip to content

Commit

Permalink
Merge pull request #4 from swaggest/httpgzip
Browse files Browse the repository at this point in the history
Enable http gzip for static assets
  • Loading branch information
vearutop authored Aug 30, 2019
2 parents e58f428 + 9268e3e commit 2a1f4de
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ module github.com/swaggest/swgui

require (
github.com/shurcooL/httpfs v0.0.0-20181222201310-74dc9339e414 // indirect
github.com/shurcooL/httpgzip v0.0.0-20190720172056-320755c1c1b0
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd
golang.org/x/tools v0.0.0-20190830172400-56125e7d709e // indirect
)
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
github.com/shurcooL/httpfs v0.0.0-20181222201310-74dc9339e414 h1:IYVb70m/qpJGjyZV2S4qbdSDnsMl+w9nsQ2iQedf1HI=
github.com/shurcooL/httpfs v0.0.0-20181222201310-74dc9339e414/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
github.com/shurcooL/httpgzip v0.0.0-20190720172056-320755c1c1b0 h1:mj/nMDAwTBiaCqMEs4cYCqF7pO6Np7vhy1D1wcQGz+E=
github.com/shurcooL/httpgzip v0.0.0-20190720172056-320755c1c1b0/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q=
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd h1:ug7PpSOB5RBPK1Kg6qskGBoP3Vnj/aNYFTznWvlkGo0=
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190830172400-56125e7d709e h1:jlbOw43fjYcUlLDKNNmKTeCQFyjkKEW/iUK7w7017XE=
golang.org/x/tools v0.0.0-20190830172400-56125e7d709e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
3 changes: 2 additions & 1 deletion v2/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"html/template"
"net/http"

"github.com/shurcooL/httpgzip"
"github.com/swaggest/swgui"
)

var staticServer = http.FileServer(assets)
var staticServer = httpgzip.FileServer(assets, httpgzip.FileServerOptions{})

// Handler handle swagger UI request
type Handler struct {
Expand Down
3 changes: 2 additions & 1 deletion v3/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"html/template"
"net/http"

"github.com/shurcooL/httpgzip"
"github.com/swaggest/swgui"
)

var staticServer = http.FileServer(assets)
var staticServer = httpgzip.FileServer(assets, httpgzip.FileServerOptions{})

// Handler handle swagger UI request
type Handler struct {
Expand Down

0 comments on commit 2a1f4de

Please sign in to comment.