Closed
Description
João Eiras opened SPR-17486 and commented
Hi.
I have the following code
webClient.get()
.uri(b -> b.path("/endpoint").build())
.attribute("x", null)
.retrieve()
.bodyToMono(String.class)
.block();
I also have a exchangeFilter
registered in the webClient
which looks up attribute "x". When calling clientRequest.attribute("x")
then I get a NPE.
java.lang.NullPointerException: null
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Optional.<init>(Optional.java:96)
at java.util.Optional.of(Optional.java:108)
at org.springframework.web.reactive.function.client.ClientRequest.attribute(ClientRequest.java:81)
default Optional<Object> attribute(String name) {
return Optional.ofNullable(attributes().get(name));
}
Thank you.
Affects: 5.0.10, 5.1 GA
Referenced from: commits 5382260, 818c2aa, d96a7b4
Backported to: 5.0.11