Skip to content

Add support to WebTestClient for consuming the ExchangeResult [SPR-15587] #20146

@spring-projects-issues

Description

@spring-projects-issues

Andy Wilkinson opened SPR-15587 and commented

WebTestClient, via BodyContentSpec, currently allows the body to be consumed with a Consumer or the result to be returned. I'd like to be able to consume the result too. Perhaps something like the following on BodyContentSpec:

BodyContentSpec consumeAsResultWith(EntityExchangeResult<byte[]> consumer);

I do wonder if this is, perhaps, pulling BodyContentSpec as bit too far away from dealing with the body's content. As an alternative, could the method be added to ResponseSpec? It would decode the UndecodedExchangeResult and then pass the resulting EntityExchangeResult to the Consumer? If it did so, I'm not sure what the method would return to allow the chaining of further method calls.


Affects: 5.0 RC1

Referenced from: commits 346d5d2

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions