forked from mtusi2026/mtusi2026lab4
lab 4 na 4
This commit is contained in:
@@ -43,3 +43,12 @@ func chatIDParam(w http.ResponseWriter, r *http.Request, requestID string) (stri
|
||||
}
|
||||
return strings.ToLower(id), true
|
||||
}
|
||||
|
||||
func uuidParam(w http.ResponseWriter, r *http.Request, requestID, name string) (string, bool) {
|
||||
id := r.PathValue(name)
|
||||
if !idgen.IsValidUUID(id) {
|
||||
writeError(w, http.StatusBadRequest, requestID, codeInvalidRequest, "invalid "+name)
|
||||
return "", false
|
||||
}
|
||||
return strings.ToLower(id), true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user