Open Fyro-Ing opened 5 months ago
cc @vietj
thanks I'll have a look
I see the behaviour is different for this case, I am thinking that the decoding of the body should be applied only when responses are 2xx that would fix this issue
The body may contain useful information (e.g. problem ID) in case of an error response. How can we get it?
more thoughts about this: since expecting
is a construct that operates at the future level and not the http request/response api level, there is no way we can have the decoding happening after the expectation.
Instead the Future.map
operator should be used, so the code would actually be like:
webClient
.get("/test")
.expecting(expectation)
.map(response -> response.bodyAsJson(Integer.class));
Therefore we might have to deprecate the the as
on HttpRequest
to discourage using it, if that can be replaced by the use of map
.
Switching to new web client expectation ( #2607 ) occurre bug when body codec response is set.
Response is decoded prior to check expecting and result to a DecodedException
Version Vertx 4.5.8
Do you have a reproducer?
same with JsonObject vs JsonArray, etc ..