Skip to content

Unable to retrieve pull request diff #93

@morozov

Description

@morozov

The following code snippet is supposed to produce the pull reques diff. It used to work a while ago but now it doesnt.

$client = new Github\Client();
$client->authenticate(
    'put-your-token-here',
    null,
    Github\Client::AUTH_URL_TOKEN
);

/** @var Github\Api\PullRequest $api */
$api = $client->api('pull_request');
$client->setHeaders(array(
    sprintf(
        'Accept: application/vnd.github.%s.diff',
        $client->getOption('api_version')
    )
));

$diff = $api->show('KnpLabs', 'php-github-api', '92');

echo gettype($diff);
// expected: string
// actual: array

The point is that here default Accept header is appepended with custom but not overridden, thus both of them are sent.

Default User-Agent and Accept headers should be sent only if other values are not specified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions