New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebClient API improvements #378
Comments
good point, I've actually proposed a new feature for the web client "expectations" that would be something like:
that produces an error if the code is not 200 there could be other expectations (around content type, etc...) |
@vietj I like the basic concept, but I'm not sure about that specific implementation. Perhaps static methods on a WebClientMappers class? Something like:
And then you could do something like:
|
that would be on HttpRequest itself so you use it before hte map. your code is incorrect because it should contains an rxSend call, so it would rather be:
|
@vietj OK, you're right. I missed the call to
|
@vietj Thinking about the approach you are suggesting, perhaps something like:
Thoughts? |
yes that seems fine, I did not have intention for body expectations first but why not ? it can help unit testing I guess. |
Oh, wait... On the headers... We would need to support |
I think we can support rather per header checking, I don't think MultiMap support is needed. |
Closing, now tracked by vert-x3/vertx-web#1013 |
Recently, while using the RxJava2 implementation of WebClient, I noticed something which is not intuitive.
When the client gets a
4XX
or a5XX
response from the server, that error does NOT trigger theonErrorReturn
path. I think I understand this to be because of it being generated code which is not "smart" enough to understand that a4XX
or5XX
is an error. Instead, I had to create amapToError
method and put it into the mix:This works, but it is not intuitive.
I propose that the documentation for the WebClient API be updated to include examples for error handling. This probably needs to be done in many other places in the Vert.x documentation as well.
The text was updated successfully, but these errors were encountered: