Stack Overflow Asked by Sumit Arora on December 4, 2020
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
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP