Skip to content

Commit c97ccbb

Browse files
ExtendedGitHubClient.java
- no longer set the HTTP method to PATCH but use the X-HTTP-Method-Override header, as the jdk's HttpURLConnection does not like the PATCH method This fixes jenkinsci#41
1 parent b51d3ab commit c97ccbb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/main/java/org/jenkinsci/plugins/pipeline/github/client/ExtendedGitHubClient.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public <V> V patch(final String uri, final Object params, final Type type) {
3131

3232
public <V> V patch(final String uri, final Object params, final Type type, final String accept) {
3333
try {
34-
final HttpURLConnection request = createPatch(uri);
34+
final HttpURLConnection request = createPost(uri);
35+
request.setRequestProperty("X-HTTP-Method-Override", "PATCH");
36+
3537
if (accept != null) {
3638
request.setRequestProperty("Accept", accept);
3739
}
@@ -41,10 +43,6 @@ public <V> V patch(final String uri, final Object params, final Type type, final
4143
}
4244
}
4345

44-
protected HttpURLConnection createPatch(final String uri) throws IOException {
45-
return this.createConnection(uri, "PATCH");
46-
}
47-
4846
public <V> V post(final String uri, final Object params, final Type type, final String accept) throws IOException {
4947
HttpURLConnection request = this.createPost(uri);
5048
if (accept != null) {

0 commit comments

Comments
 (0)