Skip to content

Commit

Permalink
feat: fix GetPaginationUsers error: "response data format is incorrec…
Browse files Browse the repository at this point in the history
…t" (#106)
  • Loading branch information
nasa1024 authored Apr 19, 2024
1 parent 419a5ab commit 8987bae
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions casdoorsdk/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,14 @@ func (c *Client) GetPaginationUsers(p int, pageSize int, queryMap map[string]str
return nil, 0, err
}

users, ok := response.Data.([]*User)
if !ok {
dataBytes, err := json.Marshal(response.Data)
if err != nil {
return nil, 0, err
}

var users []*User
err = json.Unmarshal(dataBytes, &users)
if err != nil {
return nil, 0, errors.New("response data format is incorrect")
}

Expand Down

0 comments on commit 8987bae

Please sign in to comment.