Below is a snapshot of a HTTP Get Call while using Gorilla Mux Router:
usersAPIs.HandleFunc("/users",
middleware.WrapperHandler(th.List)).
Queries("email", "{email}").
Queries("order_by", "{order_by}").
Queries("order_type", "{order_type}").
Queries("page", "{page}").
Queries("limit", "{limit}").
Methods("GET")
Now when GET call happens with all query params e.g.
http://localhost:xxxx/accounts/users?email=a&page=1&limit=4&order_by=a&order_type=b
then the gorilla mux router matches the pattern and takes it to the handler.
But when called like with fewer parameters e.g.
http://localhost:xxxx/accounts/users?email=a&page=1
then it says e.g. 404 not found means Resource path not mapped.
Questions :
#1. What has been missed here, is Go Gorilla Mux Router need all query params?
#2. What to be done If the GET query can come with zero or more parameters? e.g.
http://localhost:xxxx/accounts/users?email=a&page=1
or
http://localhost:xxxx/accounts/users?page=1
Queries(key, value) acts as a path matcher when passed to the route. Since 5 path params are expected, the route would match only if all 5 of them are present.
Though it's a little late to answer this question, but for anyone who stubles upon it later.