Compare commits
No commits in common. "d28013ae893912926a608875f16c572c1661c796" and "6d362bcf227f562af8db13ebddde565faf4ef10c" have entirely different histories.
d28013ae89
...
6d362bcf22
1 changed files with 0 additions and 20 deletions
20
main.go
20
main.go
|
@ -63,26 +63,6 @@ func handleRequest(w http.ResponseWriter, r *http.Request) {
|
|||
} else {
|
||||
w.WriteHeader(http.StatusMethodNotAllowed)
|
||||
}
|
||||
case "DELETE":
|
||||
if strings.HasPrefix(path, "/delete") {
|
||||
urlItem := strings.Split(path, "/")
|
||||
if urlExist("/" + urlItem[2]) {
|
||||
secret := r.URL.Query().Get("secret")
|
||||
if secret == db.HGet(ctx, "/"+urlItem[2], "secret").Val() {
|
||||
err := db.Del(ctx, "/"+urlItem[2])
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
} else {
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
}
|
||||
} else {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
} else {
|
||||
w.WriteHeader(http.StatusMethodNotAllowed)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue