use of com.hotels.styx.ModifyContentByAggregationExamplePlugin.Config in project styx by ExpediaGroup.
the class ModifyContentByAggregationExamplePluginTest method modifiesContent.
@Test
public void modifiesContent() {
// Set up
Config config = new Config("MyExtraText");
ModifyContentByAggregationExamplePlugin plugin = new ModifyContentByAggregationExamplePlugin(config);
LiveHttpRequest request = get("/").build();
HttpInterceptor.Chain chain = anyRequest -> Eventual.of(response().body("OriginalBody", UTF_8).build().stream());
// Execution
HttpResponse response = Mono.from(plugin.intercept(request, chain).flatMap(liveResponse -> liveResponse.aggregate(100))).block();
// Assertion
assertThat(response.bodyAs(UTF_8), is("OriginalBodyMyExtraText"));
}
Aggregations