From 80b501d1a58faa90a464fc1a848d5b9bfd2a30c5 Mon Sep 17 00:00:00 2001 From: Neeraj319 Date: Sat, 30 Dec 2023 14:30:31 +0545 Subject: [PATCH] feat: add query params parser --- router.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/router.go b/router.go index 3d88783..313d86d 100644 --- a/router.go +++ b/router.go @@ -3,6 +3,7 @@ package nirajan import ( "fmt" "net/http" + "net/url" "reflect" "runtime" "strings" @@ -335,3 +336,8 @@ func (r *SimpleRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { } r.MethodNotAllowedResp(w, req) } + +func QueryParams(req *http.Request) map[string][]string { + u, _ := url.Parse(req.URL.String()) + return u.Query() +}