-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Florian Beaufumé opened SPR-17368 and commented
I developed a simple org.springframework.web.server.WebFilter, in a reactive application based on Spring Boot 2.0.5, to log the HTTP response status (and other data not relevant here).
The filter method is basically:
return chain.filter(exchange).doAfterTerminate(
() -> System.out.println("Status=" + exchange.getResponse().getStatusCode()));
For many REST controller methods the logged status is null.
From my StackOverflow post https://stackoverflow.com/questions/52668050/spring-webflux-statuscode-is-null-in-a-webfilter I discovered that +the status is null when the return type of the REST controller does not use ResponseEntity+, e.g.: void, Mono<Void>, String, Mono<String>, MyBean, Mono<MyBean>, etc.
+The status is correctly 200 when the return type uses ResponseEntity+: ReponseEntity<Void>, Mono<ResponseEntity<Void>>, ReponseEntity<String>, Mono<ResponseEntity<String>>, ReponseEntity<MyBean>, Mono<ResponseEntity<MyBean>>, etc.
I wrote a MWE, see https://github.com/fbeaufume/webflux-filter-sample
Looks like a bug to me. Is it? Any hope for a fix?
Regards, Florian
Affects: 5.0.9
Reference URL: https://stackoverflow.com/questions/52668050/spring-webflux-statuscode-is-null-in-a-webfilter
Referenced from: commits 75b1396