mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
Add preview media type header explicitly
This commit is contained in:
@@ -141,7 +141,9 @@ public class GHLicense extends GHObject {
|
||||
protected synchronized void populate() throws IOException {
|
||||
if (description!=null) return; // already populated
|
||||
|
||||
root.retrieve().to(url, this);
|
||||
root.retrieve()
|
||||
.withHeader("Accept","application/vnd.github.drax-preview+json")
|
||||
.to(url, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -856,10 +856,7 @@ public class GHRepository extends GHObject {
|
||||
*/
|
||||
@Preview @Deprecated
|
||||
public GHLicense getLicense() throws IOException{
|
||||
return root.retrieve()
|
||||
.withHeader("Accept","application/vnd.github.drax-preview+json")
|
||||
.to(getApiTailUrl("license"), GHContentWithLicense.class)
|
||||
.wrap(this).license;
|
||||
return getLicenseContent_().license;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -872,7 +869,14 @@ public class GHRepository extends GHObject {
|
||||
*/
|
||||
@Preview @Deprecated
|
||||
public GHContent getLicenseContent() throws IOException {
|
||||
return root.retrieve().to(getApiTailUrl("license"), GHContent.class).wrap(this);
|
||||
return getLicenseContent_();
|
||||
}
|
||||
|
||||
@Preview @Deprecated
|
||||
private GHContentWithLicense getLicenseContent_() throws IOException {
|
||||
return root.retrieve()
|
||||
.withHeader("Accept","application/vnd.github.drax-preview+json")
|
||||
.to(getApiTailUrl("license"), GHContentWithLicense.class).wrap(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -353,7 +353,9 @@ public class GitHub {
|
||||
public PagedIterable<GHLicense> listLicenses() throws IOException {
|
||||
return new PagedIterable<GHLicense>() {
|
||||
public PagedIterator<GHLicense> _iterator(int pageSize) {
|
||||
return new PagedIterator<GHLicense>(retrieve().asIterator("/licenses", GHLicense[].class, pageSize)) {
|
||||
return new PagedIterator<GHLicense>(retrieve()
|
||||
.withHeader("Accept","application/vnd.github.drax-preview+json")
|
||||
.asIterator("/licenses", GHLicense[].class, pageSize)) {
|
||||
@Override
|
||||
protected void wrapUp(GHLicense[] page) {
|
||||
for (GHLicense c : page)
|
||||
@@ -376,7 +378,9 @@ public class GitHub {
|
||||
*/
|
||||
@Preview @Deprecated
|
||||
public GHLicense getLicense(String key) throws IOException {
|
||||
return retrieve().to("/licenses/" + key, GHLicense.class);
|
||||
return retrieve()
|
||||
.withHeader("Accept","application/vnd.github.drax-preview+json")
|
||||
.to("/licenses/" + key, GHLicense.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user