limit response to 200 and output Link header

This commit is contained in:
Maycon Santos 2023-12-14 17:56:09 +01:00
parent 86340fb684
commit 0cf6ece217

View File

@ -354,13 +354,13 @@ func (km *KeycloakManager) DeleteUser(userID string) error {
} }
func (km *KeycloakManager) fetchAllUserProfiles() ([]keycloakProfile, error) { func (km *KeycloakManager) fetchAllUserProfiles() ([]keycloakProfile, error) {
totalUsers, err := km.totalUsersCount() //totalUsers, err := km.totalUsersCount()
if err != nil { //if err != nil {
return nil, err // return nil, err
} //}
q := url.Values{} q := url.Values{}
q.Add("max", fmt.Sprint(*totalUsers)) q.Add("max", fmt.Sprint(200))
body, err := km.get("users", q) body, err := km.get("users", q)
if err != nil { if err != nil {
@ -409,6 +409,8 @@ func (km *KeycloakManager) get(resource string, q url.Values) ([]byte, error) {
return nil, fmt.Errorf("unable to get %s, statusCode %d", reqURL, resp.StatusCode) return nil, fmt.Errorf("unable to get %s, statusCode %d", reqURL, resp.StatusCode)
} }
log.Infof("Link header: %v", resp.Header.Get("Link"))
return io.ReadAll(resp.Body) return io.ReadAll(resp.Body)
} }