diff --git a/src/main/java/org/kohsuke/github/Requester.java b/src/main/java/org/kohsuke/github/Requester.java index 960940e7cf..253936c00a 100644 --- a/src/main/java/org/kohsuke/github/Requester.java +++ b/src/main/java/org/kohsuke/github/Requester.java @@ -287,7 +287,7 @@ public String getResponseHeader(String header) { * Set up the request parameters or POST payload. */ private void buildRequest() throws IOException { - if (!method.equals("GET")) { + if (isMethodWithBody()) { uc.setDoOutput(true); uc.setRequestProperty("Content-type", contentType); @@ -296,7 +296,6 @@ private void buildRequest() throws IOException { for (Entry e : args) { json.put(e.key, e.value); } - MAPPER.writeValue(uc.getOutputStream(), json); } else { try { byte[] bytes = new byte[32768]; @@ -311,6 +310,12 @@ private void buildRequest() throws IOException { } } + private boolean isMethodWithBody() { + if (method.equals("GET")) return false; + if (method.equals("DELETE")) return false; + return true; + } + /** * Loads pagenated resources. *