don't send an entity on DELETE's through RibbonRoutingFilter
fixes gh-73
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user