Browse Source

En cours de développement

master
mls-361 1 month ago
parent
commit
6468301f2f
  1. 2
      go.mod
  2. 4
      go.sum
  3. 10
      internal/router/router.go

2
go.mod

@ -11,7 +11,7 @@ require (
forge.chapril.org/mls-361/application v0.0.0-20210507222412-1e7c647c76cd
forge.chapril.org/mls-361/crypto v0.0.0-20210507222429-aa9bfa212956
forge.chapril.org/mls-361/errors v0.0.0-20210507222244-6017b9315140
forge.chapril.org/mls-361/jsonapi v0.0.0-20210507222537-42787c045a89
forge.chapril.org/mls-361/jsonapi v0.0.0-20210507233050-94d433fd6f49
forge.chapril.org/mls-361/logger v0.0.0-20210507222454-9faceb920b06
forge.chapril.org/mls-361/uuid v0.0.0-20210411123640-49d47af267ff
github.com/julienschmidt/httprouter v1.3.0

4
go.sum

@ -20,8 +20,8 @@ forge.chapril.org/mls-361/errors v0.0.0-20210507222244-6017b9315140 h1:uBp4Uz62/
forge.chapril.org/mls-361/errors v0.0.0-20210507222244-6017b9315140/go.mod h1:GBBbrcpLm0Hww05AoFQJY3tTXbNBOQPqV+qTFEWpL20=
forge.chapril.org/mls-361/fqdn v0.0.0-20210507222326-a85c3c19b9af h1:TbPVsBz8TYVmyqcrskFWlheyapWsuNrCVd6HedWuRjc=
forge.chapril.org/mls-361/fqdn v0.0.0-20210507222326-a85c3c19b9af/go.mod h1:AFGBvcK+UEZ9riVN+xN0suL8mVhBrxQIMKK39EX434s=
forge.chapril.org/mls-361/jsonapi v0.0.0-20210507222537-42787c045a89 h1:5la9Oz4IUCpUhs3jCQxUjkklFpSmxikLqJODy2XmDkw=
forge.chapril.org/mls-361/jsonapi v0.0.0-20210507222537-42787c045a89/go.mod h1:h7tNGoefr353rJRCt3O5fOMSMCfD8xzMX/ADulKMdq8=
forge.chapril.org/mls-361/jsonapi v0.0.0-20210507233050-94d433fd6f49 h1:1xVla5UwrjxgR9rMTsTLwYe3ntv+kTq9G0EVihVT+W0=
forge.chapril.org/mls-361/jsonapi v0.0.0-20210507233050-94d433fd6f49/go.mod h1:h7tNGoefr353rJRCt3O5fOMSMCfD8xzMX/ADulKMdq8=
forge.chapril.org/mls-361/kvfmt v0.0.0-20210507213839-4f18d8b29e73 h1:OKwxmpmkdhy9SWwZcJrz7Fp57LWpY/PNloHdFiDc4Ek=
forge.chapril.org/mls-361/kvfmt v0.0.0-20210507213839-4f18d8b29e73/go.mod h1:bv44R0CAd8lQV4ub1hjLE3kWYwpfsW4Ro9zRnD4YOMU=
forge.chapril.org/mls-361/logger v0.0.0-20210507222454-9faceb920b06 h1:8+774tb3VA3VOgzM5I42JqXUqCRf/q9sMsEwuTqEXuM=

10
internal/router/router.go

@ -46,8 +46,14 @@ func (cr *router) handle(method string, path string, handler jsonapi.Handler) {
cr.mux.Handle(
method,
path,
func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
handler.Serve(jsonapi.NewRequest(r, w))
func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
mp := make(map[string]string)
for _, p := range ps {
mp[p.Key] = p.Value
}
handler.Serve(jsonapi.NewRequest(r, w, mp))
},
)
}

Loading…
Cancel
Save