Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 59324b0

Browse filesBrowse files
committed
Add preview media type header explicitly
1 parent 6a356c8 commit 59324b0
Copy full SHA for 59324b0

File tree

Expand file treeCollapse file tree

3 files changed

+18
-8
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+18
-8
lines changed

‎src/main/java/org/kohsuke/github/GHLicense.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHLicense.java
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ public String getBody() throws IOException {
141141
protected synchronized void populate() throws IOException {
142142
if (description!=null) return; // already populated
143143

144-
root.retrieve().to(url, this);
144+
root.retrieve()
145+
.withHeader("Accept","application/vnd.github.drax-preview+json")
146+
.to(url, this);
145147
}
146148

147149
@Override

‎src/main/java/org/kohsuke/github/GHRepository.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHRepository.java
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -856,10 +856,7 @@ protected void wrapUp(GHCommitComment[] page) {
856856
*/
857857
@Preview @Deprecated
858858
public GHLicense getLicense() throws IOException{
859-
return root.retrieve()
860-
.withHeader("Accept","application/vnd.github.drax-preview+json")
861-
.to(getApiTailUrl("license"), GHContentWithLicense.class)
862-
.wrap(this).license;
859+
return getLicenseContent_().license;
863860
}
864861

865862
/**
@@ -872,7 +869,14 @@ public GHLicense getLicense() throws IOException{
872869
*/
873870
@Preview @Deprecated
874871
public GHContent getLicenseContent() throws IOException {
875-
return root.retrieve().to(getApiTailUrl("license"), GHContent.class).wrap(this);
872+
return getLicenseContent_();
873+
}
874+
875+
@Preview @Deprecated
876+
private GHContentWithLicense getLicenseContent_() throws IOException {
877+
return root.retrieve()
878+
.withHeader("Accept","application/vnd.github.drax-preview+json")
879+
.to(getApiTailUrl("license"), GHContentWithLicense.class).wrap(this);
876880
}
877881

878882
/**

‎src/main/java/org/kohsuke/github/GitHub.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GitHub.java
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,9 @@ public GHRepository getRepository(String name) throws IOException {
353353
public PagedIterable<GHLicense> listLicenses() throws IOException {
354354
return new PagedIterable<GHLicense>() {
355355
public PagedIterator<GHLicense> _iterator(int pageSize) {
356-
return new PagedIterator<GHLicense>(retrieve().asIterator("/licenses", GHLicense[].class, pageSize)) {
356+
return new PagedIterator<GHLicense>(retrieve()
357+
.withHeader("Accept","application/vnd.github.drax-preview+json")
358+
.asIterator("/licenses", GHLicense[].class, pageSize)) {
357359
@Override
358360
protected void wrapUp(GHLicense[] page) {
359361
for (GHLicense c : page)
@@ -376,7 +378,9 @@ protected void wrapUp(GHLicense[] page) {
376378
*/
377379
@Preview @Deprecated
378380
public GHLicense getLicense(String key) throws IOException {
379-
return retrieve().to("/licenses/" + key, GHLicense.class);
381+
return retrieve()
382+
.withHeader("Accept","application/vnd.github.drax-preview+json")
383+
.to("/licenses/" + key, GHLicense.class);
380384
}
381385

382386
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.