Skip to content

Commit

Permalink
add check for missing X-UserId header
Browse files Browse the repository at this point in the history
  • Loading branch information
franzmueller committed Jan 30, 2024
1 parent 894ae39 commit ace0a90
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,9 @@ func getUserId(request *http.Request) (string, error) {
}
return forUser, nil
}
return request.Header.Get("X-UserId"), nil
userid := request.Header.Get("X-UserId")
if userid == "" {
return "", errors.New("X-UserId not set")
}
return userid, nil
}

0 comments on commit ace0a90

Please sign in to comment.