Set traceRequestBody to false by default (#3439)
traceRequestBody requires the body to be buffered which reduces performance and can be problematic, such as when used in combination with `zuul.use-filter=true` and `zuul.servlet-path=/` See https://github.com/spring-cloud/spring-cloud-netflix/issues/3418 traceRequestBody should only be set when logging the request body is actually necessary.
This commit is contained in:
committed by
Spencer Gibb
parent
77b8965e29
commit
52e4f5ea59
@@ -137,7 +137,7 @@ public class ZuulProperties {
|
||||
/**
|
||||
* Flag to say that request bodies can be traced.
|
||||
*/
|
||||
private boolean traceRequestBody = true;
|
||||
private boolean traceRequestBody = false;
|
||||
|
||||
/**
|
||||
* Flag to say that path elements past the first semicolon can be dropped.
|
||||
|
||||
@@ -130,7 +130,9 @@ public class ProxyRequestHelperTests {
|
||||
RequestContext context = RequestContext.getCurrentContext();
|
||||
context.setRequest(request);
|
||||
|
||||
ProxyRequestHelper helper = new ProxyRequestHelper(new ZuulProperties());
|
||||
ZuulProperties zuulProperties = new ZuulProperties();
|
||||
zuulProperties.setTraceRequestBody(true);
|
||||
ProxyRequestHelper helper = new ProxyRequestHelper(zuulProperties);
|
||||
|
||||
assertThat(helper.shouldDebugBody(context)).as("shouldDebugBody wrong").isTrue();
|
||||
}
|
||||
@@ -139,7 +141,9 @@ public class ProxyRequestHelperTests {
|
||||
public void shouldDebugBodyNullRequest() throws Exception {
|
||||
RequestContext context = RequestContext.getCurrentContext();
|
||||
|
||||
ProxyRequestHelper helper = new ProxyRequestHelper(new ZuulProperties());
|
||||
ZuulProperties zuulProperties = new ZuulProperties();
|
||||
zuulProperties.setTraceRequestBody(true);
|
||||
ProxyRequestHelper helper = new ProxyRequestHelper(zuulProperties);
|
||||
|
||||
assertThat(helper.shouldDebugBody(context)).as("shouldDebugBody wrong").isTrue();
|
||||
}
|
||||
@@ -151,7 +155,9 @@ public class ProxyRequestHelperTests {
|
||||
RequestContext context = RequestContext.getCurrentContext();
|
||||
context.setRequest(request);
|
||||
|
||||
ProxyRequestHelper helper = new ProxyRequestHelper(new ZuulProperties());
|
||||
ZuulProperties zuulProperties = new ZuulProperties();
|
||||
zuulProperties.setTraceRequestBody(true);
|
||||
ProxyRequestHelper helper = new ProxyRequestHelper(zuulProperties);
|
||||
|
||||
assertThat(helper.shouldDebugBody(context)).as("shouldDebugBody wrong").isTrue();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user