@@ -1593,6 +1593,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
15931593 def request = request(
15941594 BODY_JSON , ' POST' ,
15951595 RequestBody . create(MediaType . get(' application/json' ), ' {"a": "x"}' ))
1596+ .header(IG_RESPONSE_BODY_TAG , ' true' )
15961597 .build()
15971598 def response = client. newCall(request). execute()
15981599 if (isDataStreamsEnabled()) {
@@ -2319,6 +2320,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
23192320 static final String IG_BODY_END_BLOCK_HEADER = " x-block-body-end"
23202321 static final String IG_BODY_CONVERTED_HEADER = " x-block-body-converted"
23212322 static final String IG_ASK_FOR_RESPONSE_HEADER_TAGS_HEADER = " x-include-response-headers-in-tags"
2323+ static final String IG_RESPONSE_BODY_TAG = " x-include-response-body-in-tags"
23222324 static final String IG_PEER_ADDRESS = " ig-peer-address"
23232325 static final String IG_PEER_PORT = " ig-peer-port"
23242326 static final String IG_RESPONSE_STATUS = " ig-response-status"
@@ -2342,6 +2344,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
23422344 boolean bodyEndBlock
23432345 boolean bodyConvertedBlock
23442346 boolean responseHeadersInTags
2347+ boolean responseBodyTag
23452348 }
23462349
23472350 static final String stringOrEmpty (String string ) {
@@ -2395,6 +2398,9 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
23952398 if (IG_ASK_FOR_RESPONSE_HEADER_TAGS_HEADER . equalsIgnoreCase(key)) {
23962399 context. responseHeadersInTags = true
23972400 }
2401+ if (IG_RESPONSE_BODY_TAG . equalsIgnoreCase(key)) {
2402+ context. responseBodyTag = true
2403+ }
23982404 } as TriConsumer<RequestContext , String , String >
23992405
24002406 final Function<RequestContext , Flow<Void > > requestHeaderDoneCb =
@@ -2503,8 +2509,10 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
25032509 .findAll { it. key != ' class' }
25042510 .collectEntries { [it. key, it. value instanceof Iterable ? it. value : [it. value]] }
25052511 }
2506- rqCtxt. traceSegment. setTagTop(' response.body' , obj as String )
25072512 Context context = rqCtxt. getData(RequestContextSlot . APPSEC )
2513+ if (context. responseBodyTag) {
2514+ rqCtxt. traceSegment. setTagTop(' response.body' , obj as String )
2515+ }
25082516 if (context. responseBlock) {
25092517 new RbaFlow (
25102518 new Flow.Action.RequestBlockingAction (413 , BlockingContentType . JSON )
0 commit comments