From 17af0a10848be1b09c2994db8d19442540f89125 Mon Sep 17 00:00:00 2001 From: Marc Spehlmann Date: Sat, 6 Oct 2018 18:39:08 -0700 Subject: [PATCH] add patch to google http client --- .../com/google/api/client/http/apache/ApacheHttpTransport.java | 3 +++ .../google/api/client/http/apache/ApacheHttpTransportTest.java | 2 ++ 2 files changed, 5 insertions(+) diff --git a/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java b/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java index 50e74dc87..0b55a4ed0 100644 --- a/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java +++ b/google-http-client/src/main/java/com/google/api/client/http/apache/ApacheHttpTransport.java @@ -35,6 +35,7 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpHead; import org.apache.http.client.methods.HttpOptions; +import org.apache.http.client.methods.HttpPatch; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; import org.apache.http.client.methods.HttpRequestBase; @@ -209,6 +210,8 @@ protected ApacheHttpRequest buildRequest(String method, String url) { requestBase = new HttpGet(url); } else if (method.equals(HttpMethods.HEAD)) { requestBase = new HttpHead(url); + } else if (method.equals(HttpMethods.PATCH)) { + requestBase = new HttpPatch(url); } else if (method.equals(HttpMethods.POST)) { requestBase = new HttpPost(url); } else if (method.equals(HttpMethods.PUT)) { diff --git a/google-http-client/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java b/google-http-client/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java index 21aa27357..07f6c29c7 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/apache/ApacheHttpTransportTest.java @@ -73,6 +73,8 @@ public void testRequestsWithContent() throws Exception { subtestUnsupportedRequestsWithContent( transport.buildRequest("HEAD", "http://www.test.url"), "HEAD"); + // Test PATCH. + execute(transport.buildRequest("PATCH", "http://www.test.url")); // Test PUT. execute(transport.buildRequest("PUT", "http://www.test.url")); // Test POST.