|
14 | 14 | import org.springframework.core.io.buffer.DataBuffer;
|
15 | 15 | import org.springframework.core.io.buffer.DataBufferFactory;
|
16 | 16 | import org.springframework.http.HttpCookie;
|
17 |
| -import org.springframework.http.HttpStatus; |
18 | 17 | import org.springframework.http.server.reactive.ServerHttpRequest;
|
19 | 18 | import org.springframework.http.server.reactive.ServerHttpResponse;
|
20 | 19 | import reactor.core.publisher.Mono;
|
21 | 20 |
|
22 | 21 | import java.lang.reflect.Executable;
|
23 |
| -import java.lang.reflect.Method; |
24 | 22 | import java.nio.charset.StandardCharsets;
|
25 | 23 | import java.util.*;
|
26 | 24 | import java.util.stream.Collectors;
|
@@ -54,7 +52,7 @@ public ElementMatcher<? super TypeDescription> getTypeMatcher() {
|
54 | 52 | return nameContainsIgnoreCase("org.springframework.web.server.adapter.HttpWebHandlerAdapter");
|
55 | 53 | }
|
56 | 54 |
|
57 |
| - public record SkipOnWrapper(Mono<Void> mono) { |
| 55 | + public record SkipOnWrapper(Mono<Void> newReturnValue) { |
58 | 56 | }
|
59 | 57 |
|
60 | 58 | public static class SpringWebfluxAdvice {
|
@@ -110,8 +108,8 @@ public static void onExit(
|
110 | 108 | // enterResult can be two things : Either the SkipOnWrapper or the ServerHttpResponse
|
111 | 109 | // ServerHttpResponse -> Extract status code.
|
112 | 110 | // SkipOnWrapper -> we blocked a request (e.g. IP Blocking), and are returning the value below
|
113 |
| - if (enterResult instanceof SkipOnWrapper wrapper && wrapper.mono() != null) { |
114 |
| - returnValue = wrapper.mono(); |
| 111 | + if (enterResult instanceof SkipOnWrapper wrapper && wrapper.newReturnValue() != null) { |
| 112 | + returnValue = wrapper.newReturnValue(); |
115 | 113 | } else if (enterResult instanceof ServerHttpResponse res) {
|
116 | 114 | // Report status code of response :
|
117 | 115 | Integer statusCode = res.getRawStatusCode();
|
|
0 commit comments