jekyll/github-metadata

Option to add header to API requests

cartersteinhoff opened this issue · 5 comments

In order to access the "topics" property from the "repository" endpoint, I need to add a header to the request.

"Note: The topics property for repositories on GitHub is currently available for developers to preview. To view the topics property in calls that return repository results, you must provide a custom media type in the Accept header:" - https://developer.github.com/v3/repos/#list-your-repositories

Is there a way to do this currently or can the feature be added?

parkr commented

In general, we like to decide that having the feature is important and enable the feature for everyone. Since it's additive, it shouldn't break anyone's current workflow. In my opinion, the best thing to do is simply add the value application/vnd.github.mercy-preview+json to the Accept header for everyone unless the latency rises unreasonably, or errors are likely to occur.

@cartersteinhoff Support for accessing topics from the repository field has been shipped in v2.13.0. Please give that version a try and let us know if this should remain open..
Thanks.

parkr commented

Fixed by #166.

@parkr Technically, #166 doesn't allow adding custom header to API requests.. just allows accessing repository topics..

parkr commented

You’re right!

I don’t think adding custom headers is a feature we’d like here. If it’s just a faster way to get to added fields, I’d rather go through the normal development process and turn it on for everyone by adding the header to the code.