From 771f0b8cd8bd94611b517885d5327a7ea9359ee9 Mon Sep 17 00:00:00 2001 From: xianlubird Date: Tue, 28 Jul 2015 23:44:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=B3=E4=BA=8EREST?= =?UTF-8?q?=E7=9A=84=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh/08.3.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/zh/08.3.md b/zh/08.3.md index 233fb7f6..57a9df8d 100644 --- a/zh/08.3.md +++ b/zh/08.3.md @@ -89,17 +89,16 @@ Go没有为REST提供直接支持,但是因为RESTful是基于HTTP协议实现 } func adduser(w http.ResponseWriter, r *http.Request) { - params := r.URL.Query() - uid := params.Get(":uid") + uid := r.FormValue("uid") fmt.Fprint(w, "you are add user %s", uid) } func main() { mux := routes.New() mux.Get("/user/:uid", getuser) - mux.Post("/user/:uid", modifyuser) + mux.Post("/user/", adduser) mux.Del("/user/:uid", deleteuser) - mux.Put("/user/", adduser) + mux.Put("/user/:uid", modifyuser) http.Handle("/", mux) http.ListenAndServe(":8088", nil) }