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

Result: allow default constructor #1609

Merged
merged 1 commit into from
Jul 5, 2023
Merged

Conversation

vmaffione
Copy link
Contributor

Allow default constructor for Result, to support use cases such as the following:

       [...]
       httplib::Client client(host);
       httplib::Result result; // needed here

        if (method == "GET") {
                result = client.Get(path);

        } else if (method == "POST") {
                result = client.Post(path, headers, body,
                                "application/json");
         }

         if (!result) {
             std::cout << "Error";
             return -1;
         }

         // use result
         [...]

httplib.h Outdated Show resolved Hide resolved
@yhirose yhirose merged commit a1e56a5 into yhirose:master Jul 5, 2023
4 checks passed
@yhirose
Copy link
Owner

yhirose commented Jul 5, 2023

@vmaffione thanks for your contribution!

@vmaffione
Copy link
Contributor Author

don't say that or you'll get more :)

Thanks for accepting the patch.

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