我想执行一个获取操作。我将名称作为资源传递给 URL。我在 Postman 中点击的 URL 是 :(localhost:8080/location/{titan rolex}我在下拉列表中选择了 GET 方法)在 Postman 中点击的 URL 中,我正在执行 GetUser func() 的主体为:
func GetUser(rw http.ResponseWriter, req *http.Request) {
}
现在我希望在 GetUser 方法中获取资源值,即“titan rolex”。我怎样才能在 golang 中实现这一目标?
在 main() 中,我有这个:
http.HandleFunc("/location/{titan rolex}", GetUser)
提前致谢。
阿波罗的战车
相关分类