Skip to content

Commit

Permalink
Re-add Apache PATCH request (#547)
Browse files Browse the repository at this point in the history
* Revert "Revert "add patch to google http client (#486)" (#493)"

This reverts commit 9de9cbb.

* Move the new handlers to the apache-transport from the legacy apache-transport
  • Loading branch information
chingor13 authored Dec 28, 2018
1 parent ce27437 commit 2635d5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2635d5a

Please sign in to comment.