Skip to content

Commit

Permalink
fix(config/fasthttp): add FormValueFunc
Browse files Browse the repository at this point in the history
  • Loading branch information
savsgio committed Jan 19, 2023
1 parent 44c121d commit 0ca69fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions atreugo.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func newFasthttpServer(cfg Config) *fasthttp.Server {
ConnState: cfg.ConnState,
Logger: cfg.Logger,
TLSConfig: cfg.TLSConfig,
FormValueFunc: cfg.FormValueFunc,
}
}

Expand Down
2 changes: 1 addition & 1 deletion atreugo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
var notConfigFasthttpFields = []string{
"Handler",
"ErrorHandler",
"MaxKeepaliveDuration", // Deprecated: Use IdleTimeout instead.
}

func Test_New(t *testing.T) { //nolint:funlen,gocognit,gocyclo
Expand Down Expand Up @@ -231,6 +230,7 @@ func Test_newFasthttpServer(t *testing.T) { //nolint:funlen
ConnState: func(net.Conn, fasthttp.ConnState) {},
Logger: testLog,
TLSConfig: &tls.Config{ServerName: "test", MinVersion: tls.VersionTLS13},
FormValueFunc: func(ctx *fasthttp.RequestCtx, key string) []byte { return nil },
}

srv := newFasthttpServer(cfg)
Expand Down
6 changes: 6 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ type Config struct { // nolint:maligned
// called when a client connection changes state. See the
// ConnState type and associated constants for details.
ConnState func(net.Conn, fasthttp.ConnState)

// FormValueFunc, which is used by RequestCtx.FormValue and support for customising
// the behaviour of the RequestCtx.FormValue function.
//
// NetHttpFormValueFunc gives a FormValueFunc func implementation that is consistent with net/http.
FormValueFunc fasthttp.FormValueFunc
}

// StaticFS represents settings for serving static files
Expand Down

0 comments on commit 0ca69fa

Please sign in to comment.