go-macaron / gzip Goto Github PK
View Code? Open in Web Editor NEWPackage gzip is a middleware that provides Gzip compress to responses for Macaron.
License: Apache License 2.0
Package gzip is a middleware that provides Gzip compress to responses for Macaron.
License: Apache License 2.0
package main
import (
"github.com/go-macaron/gzip"
"gopkg.in/macaron.v1"
)
func main() {
m := macaron.Classic()
m.Use(gzip.Gziper())
m.Get("/", myHandler)
m.Run()
}
func myHandler(ctx *macaron.Context) {
panic("test")
ctx.Resp.Write([]byte("the request path is: " + ctx.Req.RequestURI))
}
加入gzip中间件后,panic时不显示错误页面,请求修复
Hi!
Thanks for creating macaron, it's amazing!
We have a usecase where some client libraries don't play nice with gzipped content
It'd be great if gzipping can be turned off for specific routes via a middleware
we have a use case where requests are conditionally proxied to another service. That other service will already compress the response, but this middleware is compressing the body a second time.
It seems like this handler should exit early if there is already a "Content-Encoding: gzip" header already set on the response.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.