From 4446f727ea022d89395db48d649f2cb0edef31bc Mon Sep 17 00:00:00 2001 From: Dmitry Harnitski Date: Wed, 19 Apr 2017 23:22:28 -0400 Subject: [PATCH] 03.4.md - use DELETE HTTP method In REST we should use DELETE HTTP method for deletion - http://www.restapitutorial.com/lessons/httpmethods.html --- en/03.4.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/03.4.md b/en/03.4.md index 123db21e..b5b47bbb 100644 --- a/en/03.4.md +++ b/en/03.4.md @@ -141,7 +141,7 @@ When the match is made on the `HandleFunc` function, the URL is matched, so supp http.HandleFunc("/delete/", views.DeleteTaskFunc) //DeleteTaskFunc is used to delete a task, trash = move to recycle bin, delete = permanent delete func DeleteTaskFunc(w http.ResponseWriter, r *http.Request) { - if r.Method == "GET" { + if r.Method == "DELETE" { id := r.URL.Path[len("/delete/"):] if id == "all" { db.DeleteAll()