Updated dependencies
This commit is contained in:
13
Context.go
13
Context.go
@ -5,6 +5,8 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"unsafe"
|
||||
|
||||
"git.akyoto.dev/go/router"
|
||||
)
|
||||
|
||||
// Context represents the interface for a request & response context.
|
||||
@ -33,7 +35,7 @@ type ctx struct {
|
||||
request *http.Request
|
||||
response http.ResponseWriter
|
||||
server *server
|
||||
params []param
|
||||
params []router.Parameter
|
||||
handlerCount uint8
|
||||
}
|
||||
|
||||
@ -64,7 +66,7 @@ func (ctx *ctx) Get(param string) string {
|
||||
for i := range len(ctx.params) {
|
||||
p := ctx.params[i]
|
||||
|
||||
if p.Name == param {
|
||||
if p.Key == param {
|
||||
return p.Value
|
||||
}
|
||||
}
|
||||
@ -147,6 +149,9 @@ func (ctx *ctx) WriteString(body string) (int, error) {
|
||||
}
|
||||
|
||||
// addParameter adds a new parameter to the context.
|
||||
func (ctx *ctx) addParameter(name string, value string) {
|
||||
ctx.params = append(ctx.params, param{name, value})
|
||||
func (ctx *ctx) addParameter(key string, value string) {
|
||||
ctx.params = append(ctx.params, router.Parameter{
|
||||
Key: key,
|
||||
Value: value,
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user