Skip to content

Commit

Permalink
feat: add query params parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeraj319 committed Dec 30, 2023
1 parent 234326a commit 80b501d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package nirajan
import (
"fmt"
"net/http"
"net/url"
"reflect"
"runtime"
"strings"
Expand Down Expand Up @@ -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()
}

0 comments on commit 80b501d

Please sign in to comment.