Commit 9add6f1e by Spencer Gibb

don't send an entity on DELETE's through RibbonRoutingFilter

fixes gh-73
parent c28b3252
......@@ -74,6 +74,7 @@ public class RibbonRoutingFilter extends SpringFilter {
getBean(RibbonClientPreprocessor.class).preprocess(serviceId);
//TODO: update to ribbon-rxnetty when available
RestClient restClient = getBean(SpringClientFactory.class).namedClient(serviceId, RestClient.class);
String uri = request.getRequestURI();
......@@ -199,6 +200,10 @@ public class RibbonRoutingFilter extends SpringFilter {
private InputStream getRequestBody(HttpServletRequest request) {
InputStream requestEntity = null;
//ApacheHttpClient4Handler does not support body in delete requests
if (request.getMethod().equals("DELETE")) {
return null;
}
try {
requestEntity = (InputStream) RequestContext.getCurrentContext().get(
"requestEntity");
......
......@@ -32,7 +32,7 @@ public class SampleZuulProxyApplicationTests {
private ZuulHandlerMapping mapping;
@Test
public void deleteOnSelf() {
public void deleteOnSelfViaSimpleHostRoutingFilter() {
routes.getRoutes().put("/self/**", "http://localhost:" + port + "/local");
mapping.registerHandlers(routes.getRoutes());
ResponseEntity<String> result = new TestRestTemplate().exchange("http://localhost:" + port + "/self/1",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment