Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Refactor init and add compression support. #12

wants to merge 1 commit into from

Conversation

knadh
Copy link
Contributor

@knadh knadh commented Jan 31, 2025

  • 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.

@knadh knadh requested a review from rhnvrm January 31, 2025 11:43
@knadh knadh force-pushed the v2 branch 2 times, most recently from 9610b3d to 3595bd6 Compare January 31, 2025 11:45
- 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 {
Copy link
Member

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
Copy link
Member

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{})
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants