mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-04-02 02:57:15 +08:00
Add extra error in account info handler
This commit is contained in:
parent
0e6b2bbf5c
commit
8337f8021d
@ -30,6 +30,11 @@ type AccountInfoResponse struct{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HandleAccountInfo(w http.ResponseWriter, r *http.Request) {
|
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"))
|
token, err := base64.StdEncoding.DecodeString(r.Header.Get("Authorization"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, fmt.Sprintf("failed to decode token: %s", err), http.StatusBadRequest)
|
http.Error(w, fmt.Sprintf("failed to decode token: %s", err), http.StatusBadRequest)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user