Browse Source

Validate endpoint input

master
Daniel Lim 3 years ago
parent
commit
8901104b9a
  1. 7
      main.go

7
main.go

@ -117,9 +117,12 @@ func GetPermission(w http.ResponseWriter, r *http.Request, p httprouter.Params)
userID := p.ByName("userid")
conversationID := p.ByName("conversationid")
id := userID + "+" + conversationID
if userID == "" || conversationID == "" {
http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
return
}
exists, err := redisClient.Exists(id).Result()
exists, err := redisClient.Exists(userID + "+" + conversationID).Result()
if err != nil {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return

Loading…
Cancel
Save