@@ -1593,6 +1593,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
1593
1593
def request = request(
1594
1594
BODY_JSON , ' POST' ,
1595
1595
RequestBody . create(MediaType . get(' application/json' ), ' {"a": "x"}' ))
1596
+ .header(IG_RESPONSE_BODY_TAG , ' true' )
1596
1597
.build()
1597
1598
def response = client. newCall(request). execute()
1598
1599
if (isDataStreamsEnabled()) {
@@ -2319,6 +2320,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
2319
2320
static final String IG_BODY_END_BLOCK_HEADER = " x-block-body-end"
2320
2321
static final String IG_BODY_CONVERTED_HEADER = " x-block-body-converted"
2321
2322
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"
2322
2324
static final String IG_PEER_ADDRESS = " ig-peer-address"
2323
2325
static final String IG_PEER_PORT = " ig-peer-port"
2324
2326
static final String IG_RESPONSE_STATUS = " ig-response-status"
@@ -2342,6 +2344,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
2342
2344
boolean bodyEndBlock
2343
2345
boolean bodyConvertedBlock
2344
2346
boolean responseHeadersInTags
2347
+ boolean responseBodyTag
2345
2348
}
2346
2349
2347
2350
static final String stringOrEmpty (String string ) {
@@ -2395,6 +2398,9 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
2395
2398
if (IG_ASK_FOR_RESPONSE_HEADER_TAGS_HEADER . equalsIgnoreCase(key)) {
2396
2399
context. responseHeadersInTags = true
2397
2400
}
2401
+ if (IG_RESPONSE_BODY_TAG . equalsIgnoreCase(key)) {
2402
+ context. responseBodyTag = true
2403
+ }
2398
2404
} as TriConsumer<RequestContext , String , String >
2399
2405
2400
2406
final Function<RequestContext , Flow<Void > > requestHeaderDoneCb =
@@ -2503,8 +2509,10 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
2503
2509
.findAll { it. key != ' class' }
2504
2510
.collectEntries { [it. key, it. value instanceof Iterable ? it. value : [it. value]] }
2505
2511
}
2506
- rqCtxt. traceSegment. setTagTop(' response.body' , obj as String )
2507
2512
Context context = rqCtxt. getData(RequestContextSlot . APPSEC )
2513
+ if (context. responseBodyTag) {
2514
+ rqCtxt. traceSegment. setTagTop(' response.body' , obj as String )
2515
+ }
2508
2516
if (context. responseBlock) {
2509
2517
new RbaFlow (
2510
2518
new Flow.Action.RequestBlockingAction (413 , BlockingContentType . JSON )
0 commit comments