Updated dependencies

This commit is contained in:
2024-03-15 10:06:17 +01:00
parent 8f135c1dcd
commit 4faeb6e956
6 changed files with 19 additions and 20 deletions

View File

@ -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,
})
}