Add extra error in account info handler

pull/1/head
maru 2023-12-28 20:11:54 -05:00
parent 0e6b2bbf5c
commit 8337f8021d
No known key found for this signature in database
GPG Key ID: 37689350E9CD0F0D
1 changed files with 5 additions and 0 deletions

View File

@ -30,6 +30,11 @@ type AccountInfoResponse struct{
}
func HandleAccountInfo(w http.ResponseWriter, r *http.Request) {
if r.Header.Get("Authorization") == "" {
http.Error(w, "missing token", http.StatusBadRequest)
return
}
token, err := base64.StdEncoding.DecodeString(r.Header.Get("Authorization"))
if err != nil {
http.Error(w, fmt.Sprintf("failed to decode token: %s", err), http.StatusBadRequest)