-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Create a don.Context interface with an implementation that calls out to fasthttp.
don.Context Methods:
context.Contextio.Reader(reads from request body)io.Writer(writes to response body)Body() []byte(request body)Method() stringURL() don.URL(request URL)RequestHeader() don.HeaderResponseHeader() don.HeaderQuery() don.Params(request URL query)Path() don.Params(request path params)Status(int) don.Params(sets status code)Redirect(string, int)Decode(any) error(decode request body, path, header & query to struct)Encode(any) error(encode and write to response body)
don.Header Methods:
Get(string) stringValues(string) []stringAdd(k,v string)Set(k,v string)Range(f func(k,v string))
don.Params Methods:
Get(string) stringValues(string) []stringRange(f func(k,v string))
Use this interface in middleware and handlers that don't use don.H. Old style handlers using the fasthttp request directly should also still be supported via an adapter.
This will allow don to also run on standard lib net/http down the line by creating a second implementation of don.Context that wraps the standard lib request & response writer.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels