-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor init and add compression support. #12
base: master
Are you sure you want to change the base?
Conversation
9610b3d
to
3595bd6
Compare
- Break to `/v2` to introduce `Options{}` that's pass to lib init. - Add `CompressOptions{}` to enable zstd|br|gzip|deflate auto-compression support offered by fasthttp.
|
||
// If compression is enabled, wrap the handler with fasthttp's CompressHandler | ||
// which automatically handles the compression logic. | ||
if f.opt.CompressionOpt.Enabled { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can rename this to opt.Compression? Type name can remain CompressionOpt.
// Fastglue is the "glue" wrapper over fasthttp and fasthttprouter. | ||
type Fastglue struct { | ||
Router *fasthttprouter.Router | ||
Server *fasthttp.Server | ||
context interface{} | ||
MatchedRoutePathParam string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MatchedRoutePathParam
This is setup in NewGlue in custom.go, maybe it can be an opt since currently we depend on NewGlue()
fastglue.NewGlue() <- Deprecate this since we are doing a v2?
@@ -77,7 +77,7 @@ func myRedirectHandler(r *fastglue.Request) error { | |||
} | |||
|
|||
func main() { | |||
f := fastglue.NewGlue() | |||
f := fastglue.NewGlue(fastglue.Options{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New vs New Glue, its confusing can be deprecated?
/v2
to introduceOptions{}
that's pass to lib init.CompressOptions{}
to enable zstd|br|gzip|deflate auto-compression support offered by fasthttp.