Skip to content

Commit 3dd3272

Browse files
committed
Merge pull request astaxie#500 from xianlubird/master
修改关于REST的一些问题
2 parents d0fbebe + 771f0b8 commit 3dd3272

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

zh/08.3.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,16 @@ Go没有为REST提供直接支持,但是因为RESTful是基于HTTP协议实现
8989
}
9090

9191
func adduser(w http.ResponseWriter, r *http.Request) {
92-
params := r.URL.Query()
93-
uid := params.Get(":uid")
92+
uid := r.FormValue("uid")
9493
fmt.Fprint(w, "you are add user %s", uid)
9594
}
9695

9796
func main() {
9897
mux := routes.New()
9998
mux.Get("/user/:uid", getuser)
100-
mux.Post("/user/:uid", modifyuser)
99+
mux.Post("/user/", adduser)
101100
mux.Del("/user/:uid", deleteuser)
102-
mux.Put("/user/", adduser)
101+
mux.Put("/user/:uid", modifyuser)
103102
http.Handle("/", mux)
104103
http.ListenAndServe(":8088", nil)
105104
}

0 commit comments

Comments
 (0)