String result = api.patch("", "foo");
assertEquals(result, "fooPATCHREDIRECT");
assertEquals(server.getRequestCount(), 1);
assertEquals(redirectTarget.getRequestCount(), 1);
// Verify that the body was populated after the redirect
RecordedRequest request = server.takeRequest();
assertEquals(request.getMethod(), "PATCH");
assertEquals(new String(request.getBody(), "UTF-8"), "foo");
request = redirectTarget.takeRequest();
assertEquals(request.getMethod(), "PATCH");
assertEquals(new String(request.getBody(), "UTF-8"), "foo");
} finally {
close(api, true);
redirectTarget.shutdown();
server.shutdown();
}