Skip to content
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

Added a synchronous interface to the HttpClient #166

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

oktal
Copy link

@oktal oktal commented Dec 16, 2014

No description provided.

{
return [=](const HttpRequest&, HttpClientError error, int statusCode,
std::string&& headers, std::string&& body) {
if (error != HttpClientError::None) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si une erreur est retournee, elle doit faire partie de la reponse retournee ou lancer une exception. Ici elle est simplement ignoree, ce qui est dangereux.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I didn't know what do to with that since HttpResponse does not contain any errorCode field. I didn't want to add this field in the class directly because the class is used for server-side code (HttpEndpoint).

So I guess throwing an exception will do for now ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I didn't know what do to with that since HttpResponse does not
contain any errorCode field. I didn't want to add this field in the
class directly because the class is used for server-side code
(HttpEndpoint).

So I guess throwing an exception will do for now ?

What matters here is to have a behaviour that would be compatible with
the one from HttpRestProxy. But on the other hand, I think the passing
of error codes enables better practices with regards to error handling.
I would thus improve HttpResponse with an HttpClientError member instead.

@wsourdeau
Copy link
Contributor

-1 for now. We should make use of EpollLoop::loop in order to ensure that operations have been completed, instead of a distinct msg loop thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants