@@ -99,6 +99,7 @@ class GatewayBridgeSpecification extends DDSpecification {
99
99
BiFunction<RequestContext , StoredBodySupplier , Void > requestBodyStartCB
100
100
BiFunction<RequestContext , StoredBodySupplier , Flow<Void > > requestBodyDoneCB
101
101
BiFunction<RequestContext , Object , Flow<Void > > requestBodyProcessedCB
102
+ BiFunction<RequestContext , Object , Flow<Void > > responseBodyCB
102
103
BiFunction<RequestContext , Integer , Flow<Void > > responseStartedCB
103
104
TriConsumer<RequestContext , String , String > respHeaderCB
104
105
Function<RequestContext , Flow<Void > > respHeadersDoneCB
@@ -449,6 +450,7 @@ class GatewayBridgeSpecification extends DDSpecification {
449
450
1 * ig. registerCallback(EVENTS . requestBodyStart(), _) >> { requestBodyStartCB = it[1 ]; null }
450
451
1 * ig. registerCallback(EVENTS . requestBodyDone(), _) >> { requestBodyDoneCB = it[1 ]; null }
451
452
1 * ig. registerCallback(EVENTS . requestBodyProcessed(), _) >> { requestBodyProcessedCB = it[1 ]; null }
453
+ 1 * ig. registerCallback(EVENTS . responseBody(), _) >> { responseBodyCB = it[1 ]; null }
452
454
1 * ig. registerCallback(EVENTS . responseStarted(), _) >> { responseStartedCB = it[1 ]; null }
453
455
1 * ig. registerCallback(EVENTS . responseHeader(), _) >> { respHeaderCB = it[1 ]; null }
454
456
1 * ig. registerCallback(EVENTS . responseHeaderDone(), _) >> { respHeadersDoneCB = it[1 ]; null }
@@ -1314,4 +1316,17 @@ class GatewayBridgeSpecification extends DDSpecification {
1314
1316
0 * traceSegment.setTagTop(_, _)
1315
1317
}
1316
1318
1319
+ void 'test on response body callback'() {
1320
+ when:
1321
+ responseBodyCB.apply(ctx, [test: 'this is a test'])
1322
+
1323
+ then:
1324
+ 1 * eventDispatcher.getDataSubscribers(KnownAddresses.RESPONSE_BODY_OBJECT) >> nonEmptyDsInfo
1325
+ 1 * eventDispatcher.publishDataEvent(_, _, _, _) >> {
1326
+ final bundle = it[2] as DataBundle
1327
+ final body = bundle.get(KnownAddresses.RESPONSE_BODY_OBJECT)
1328
+ assert body['test'] == 'this is a test'
1329
+ }
1330
+ }
1331
+
1317
1332
}
0 commit comments