Skip to content

Commit 63703dd

Browse files
committed
Use the new helper in KeyRevocationHandler.
1 parent 4bc18ee commit 63703dd

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

api_key.go

+2-13
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,8 @@ func KeyGenerationHandler(c *Context, w http.ResponseWriter, r *http.Request) {
9393

9494
// KeyRevocationHandler marks an API key as invalid for a specific account.
9595
func KeyRevocationHandler(c *Context, w http.ResponseWriter, r *http.Request) {
96-
if err := r.ParseForm(); err != nil {
97-
APIError{
98-
Message: fmt.Sprintf("Unable to parse URL parameters: %v", err),
99-
}.Log("").Report(w, http.StatusBadRequest)
100-
return
101-
}
102-
103-
accountName, apiKey := r.FormValue("accountName"), r.FormValue("apiKey")
104-
if accountName == "" || apiKey == "" {
105-
APIError{
106-
UserMessage: `Missing required query parameters "accountName" and "apiKey".`,
107-
LogMessage: "Key revocation request missing required query parameters.",
108-
}.Log("").Report(w, http.StatusBadRequest)
96+
accountName, apiKey, ok := ExtractKeyCredentials(w, r, "Key revocation")
97+
if !ok {
10998
return
11099
}
111100

0 commit comments

Comments
 (0)