Skip to content

setPerPage doesn't work in some cases #538

Description

@offsky

This doesn't work:

$api = $client->api('users');
$api->setPerPage(100);
$response = $api->all($since);

The reason is because the api adds a "?since=1234" to the path and then another "?per_page=100" is added to the path to make an invalid url. The second ? should be an &.

Here is the solution:
AbstractAPI.php::get()

...
if (count($parameters) > 0) {
            if(strpos($path,"?")===false) {
                $path .= '?'.http_build_query($parameters);
            } else {
                $path .= '&'.http_build_query($parameters);
            }
}
...

Pull request incomming

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions