问题描述
以下是使用Gorilla Mux路由器时HTTP Get呼叫的快照:
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")
http://localhost:xxxx/accounts/users?email=a&page=1&limit=4&order_by=a&order_type=b
然后大猩猩多路复用器路由器匹配该模式并将其带到处理程序。
但是当调用时带有较少的参数,例如
http://localhost:xxxx/accounts/users?email=a&page=1
然后说例如找不到404表示资源路径未映射。
问题:
#1。这里错过了什么,Go Gorilla Mux Router是否需要所有查询参数?
#2。如果GET查询可以带有零个或多个参数,该怎么办?例如
http://localhost:xxxx/accounts/users?email=a&page=1
或
http://localhost:xxxx/accounts/users?page=1
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)