diff options
Diffstat (limited to 'vendor/github.com/gin-contrib/gzip/README.md')
-rw-r--r-- | vendor/github.com/gin-contrib/gzip/README.md | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/vendor/github.com/gin-contrib/gzip/README.md b/vendor/github.com/gin-contrib/gzip/README.md deleted file mode 100644 index 2f94d053d..000000000 --- a/vendor/github.com/gin-contrib/gzip/README.md +++ /dev/null @@ -1,135 +0,0 @@ -# GZIP gin's middleware - -[](https://github.com/gin-contrib/gzip/actions/workflows/go.yml) -[](https://codecov.io/gh/gin-contrib/gzip) -[](https://goreportcard.com/report/github.com/gin-contrib/gzip) -[](https://godoc.org/github.com/gin-contrib/gzip) -[](https://gitter.im/gin-gonic/gin) - -Gin middleware to enable `GZIP` support. - -## Usage - -Download and install it: - -```sh -go get github.com/gin-contrib/gzip -``` - -Import it in your code: - -```go -import "github.com/gin-contrib/gzip" -``` - -Canonical example: - -```go -package main - -import ( - "fmt" - "net/http" - "time" - - "github.com/gin-contrib/gzip" - "github.com/gin-gonic/gin" -) - -func main() { - r := gin.Default() - r.Use(gzip.Gzip(gzip.DefaultCompression)) - r.GET("/ping", func(c *gin.Context) { - c.String(http.StatusOK, "pong "+fmt.Sprint(time.Now().Unix())) - }) - - // Listen and Server in 0.0.0.0:8080 - if err := r.Run(":8080"); err != nil { - log.Fatal(err) - } -} -``` - -Customized Excluded Extensions - -```go -package main - -import ( - "fmt" - "net/http" - "time" - - "github.com/gin-contrib/gzip" - "github.com/gin-gonic/gin" -) - -func main() { - r := gin.Default() - r.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedExtensions([]string{".pdf", ".mp4"}))) - r.GET("/ping", func(c *gin.Context) { - c.String(http.StatusOK, "pong "+fmt.Sprint(time.Now().Unix())) - }) - - // Listen and Server in 0.0.0.0:8080 - if err := r.Run(":8080"); err != nil { - log.Fatal(err) - } -} -``` - -Customized Excluded Paths - -```go -package main - -import ( - "fmt" - "net/http" - "time" - - "github.com/gin-contrib/gzip" - "github.com/gin-gonic/gin" -) - -func main() { - r := gin.Default() - r.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedPaths([]string{"/api/"}))) - r.GET("/ping", func(c *gin.Context) { - c.String(http.StatusOK, "pong "+fmt.Sprint(time.Now().Unix())) - }) - - // Listen and Server in 0.0.0.0:8080 - if err := r.Run(":8080"); err != nil { - log.Fatal(err) - } -} -``` - -Customized Excluded Paths - -```go -package main - -import ( - "fmt" - "net/http" - "time" - - "github.com/gin-contrib/gzip" - "github.com/gin-gonic/gin" -) - -func main() { - r := gin.Default() - r.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedPathsRegexs([]string{".*"}))) - r.GET("/ping", func(c *gin.Context) { - c.String(http.StatusOK, "pong "+fmt.Sprint(time.Now().Unix())) - }) - - // Listen and Server in 0.0.0.0:8080 - if err := r.Run(":8080"); err != nil { - log.Fatal(err) - } -} -``` |