Skip to content

Commit

Permalink
Error catching for json encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
BreathXV committed Jun 5, 2024
1 parent cfcfaef commit 02cd2c8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion handlers/user_allowlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ func (m *Database) CheckWhitelistHandler(w http.ResponseWriter, r *http.Request)

resPayload := UserWhitelistResponsePayload{Whitelisted: whitelisted}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(resPayload)
if err := json.NewEncoder(w).Encode(resPayload); err != nil {
http.Error(w, "Internal server error", http.StatusInternalServerError)
return
}
}

// TODO: Add a route/func to get all whitelisted identity Ids for that server Id.
Expand Down

0 comments on commit 02cd2c8

Please sign in to comment.