Skip to content

Commit 0ca69fa

Browse files
committed
fix(config/fasthttp): add FormValueFunc
1 parent 44c121d commit 0ca69fa

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

atreugo.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ func newFasthttpServer(cfg Config) *fasthttp.Server {
109109
ConnState: cfg.ConnState,
110110
Logger: cfg.Logger,
111111
TLSConfig: cfg.TLSConfig,
112+
FormValueFunc: cfg.FormValueFunc,
112113
}
113114
}
114115

atreugo_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
var notConfigFasthttpFields = []string{
2525
"Handler",
2626
"ErrorHandler",
27-
"MaxKeepaliveDuration", // Deprecated: Use IdleTimeout instead.
2827
}
2928

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

236236
srv := newFasthttpServer(cfg)

types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,12 @@ type Config struct { // nolint:maligned
354354
// called when a client connection changes state. See the
355355
// ConnState type and associated constants for details.
356356
ConnState func(net.Conn, fasthttp.ConnState)
357+
358+
// FormValueFunc, which is used by RequestCtx.FormValue and support for customising
359+
// the behaviour of the RequestCtx.FormValue function.
360+
//
361+
// NetHttpFormValueFunc gives a FormValueFunc func implementation that is consistent with net/http.
362+
FormValueFunc fasthttp.FormValueFunc
357363
}
358364

359365
// StaticFS represents settings for serving static files

0 commit comments

Comments
 (0)