question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ordering of WebClient.filter(s) [SPR-15657]

See original GitHub issue

Joe Grandja opened SPR-15657 and commented

Given this filter configuration for WebClient:

this.webClient
   .filter(filter1())
   .filter(filter2())
   .filter(filter3())
   .filter(filter4())

The expectation is that the filters would be applied in the following order: filter1, filter2, filter3, filter4. However, that is not the case, as they are applied in reverse order.

It seems a bit confusing compared to the way a Reactive stream is defined and executed in a top-down approach (the way the code reads).

Does it make sense to have the filters applied in the order they are defined - top-down approach?


Affects: 5.0 RC1

Issue Links:

  • #20250 Simplify applying a strategy to requests from WebTestClient and WebTestClient

0 votes, 5 watchers

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:24

github_iconTop GitHub Comments

1reaction
spring-projects-issuescommented, Jan 11, 2019

Joe Grandja commented

Arjen, I forgot about the option of andThen for composition. This ordering is clear to me using that approach and may be what I end up using. Thanks for the tip.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring WebClient Filters - Baeldung
A filter can intercept, examine, and modify a client request (or response). Filters are very suitable for adding functionality to every single ...
Read more >
WebClient filters doOnNext called in reverse order
The filter1 is invoked after filter2 but doOnNext is invoked in the reverse order. I read this discussion https://github.com/spring-projects/ ...
Read more >
WebClient.Builder (Spring Framework 5.0.9.RELEASE API)
Manipulate the filters with the given consumer. The list provided to the consumer is "live", so that the consumer can be used to...
Read more >
Spring 5 WebClient and WebTestClient Tutorial with Examples
WebClient is a non-blocking, reactive HTTP client with a fluent ... you a bunch of customization options including filters, default headers, ...
Read more >
Customize Spring WebClient with WebClientCustomizer
The automatic registration of our WebClient customizations is done ... @Order(0) ... cookies, exchange strategies, filters, and much more.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found