Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing header in /user/installations requests #882

Closed
vovayatsyuk opened this issue Jun 23, 2020 · 1 comment · Fixed by #883
Closed

Missing header in /user/installations requests #882

vovayatsyuk opened this issue Jun 23, 2020 · 1 comment · Fixed by #883

Comments

@vovayatsyuk
Copy link
Contributor

These two methods need a application/vnd.github.machine-man-preview+json header: https://github.com/KnpLabs/php-github-api/blob/master/lib/Github/Api/CurrentUser.php#L187-L206

Here is a new requirement:
https://developer.github.com/v3/apps/installations/#list-app-installations-accessible-to-the-user-access-token
https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-access-token

Note: To access the API with your GitHub App, you must provide a custom media type in the Accept Header for your requests.

application/vnd.github.machine-man-preview+json

I can create a PR and move the methods to Apps.php which already has a method to add required header, or I can copy AcceptHeaderTrait to the CurrentUser class.

How do you want to fix it?

@acrobat
Copy link
Collaborator

acrobat commented Jun 23, 2020

@vovayatsyuk Can you add the AcceptHeaderTrait to the CurrentUser api class and set the acceptHeader property in each method. See the proctection api forexample.

public function show($username, $repository, $branch)
{
// Preview endpoint
$this->acceptHeaderValue = 'application/vnd.github.luke-cage-preview+json';
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection');
}

acrobat added a commit that referenced this issue Jun 24, 2020
…yuk)

This PR was merged into the 2.15.x-dev branch.

Discussion
----------

This PR fixes #882. 

Added missing headers in CurrentUser class methods and fixed not working links.


Commits
-------

63ab967 Added missing 'machine-man-preview' accept headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants