User lookup by ID fails #39

Closed
opened 2024-03-25 02:32:48 +01:00 by digital-mint-creature · 0 comments
digital-mint-creature commented 2024-03-25 02:32:48 +01:00 (Migrated from github.com)

Issue Summary

When attempting to call get_users_by_id(), the call fails with a 400 error. This is due to a bug in the underlying get_users() function, which attempts to get the first ID value from the names array rather than ids, resulting in a request that looks like this:

GET /helix/users/?id=<null>&id=000000000

(where the second id= is the first element in the ids array)

Steps to Reproduce

Create a TwitchAPIConnection and call get_users_by_id() with an array containing at least one valid id.

Expected Behavior

The call should succeed and return information on the user.

Actual Behavior

The call returns an empty response due to a 400 error.

The fix is pretty simple - just change line 92 of api_connection.gd to call ids.pop_back() rather than names.pop_back().

### Issue Summary When attempting to call `get_users_by_id()`, the call fails with a 400 error. This is due to a bug in the underlying `get_users()` function, which attempts to get the first ID value from the `names` array rather than `ids`, resulting in a request that looks like this: ``` GET /helix/users/?id=<null>&id=000000000 ``` (where the second `id=` is the first element in the `ids` array) ### Steps to Reproduce Create a `TwitchAPIConnection` and call `get_users_by_id()` with an array containing at least one valid id. ### Expected Behavior The call should succeed and return information on the user. ### Actual Behavior The call returns an empty response due to a 400 error. The fix is pretty simple - just change [line 92 of api_connection.gd](https://github.com/issork/gift/blob/3ef9a2053c6a714547bd6a03b121a66f877dda6d/addons/gift/api_connection.gd#L92) to call `ids.pop_back()` rather than `names.pop_back()`.
Sign in to join this conversation.
No description provided.