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

Add response constructor overload #495

Merged
merged 1 commit into from
Jul 9, 2022
Merged

Add response constructor overload #495

merged 1 commit into from
Jul 9, 2022

Conversation

aloussase
Copy link
Contributor

Added a constructor accepting a status code and a r-value returnable. This is convenient so we can return custom returnables along with a status code without having to create an l-value first like this:

class ApiResponse: public crow::returnable
{
  ...
};

// Inside a handler
return crow::response(201, ApiResponse{...});

Before we had to do

ApiResponse response{...};
return crow::response(201, response);

Copy link
Member

@The-EDev The-EDev left a comment

Choose a reason for hiding this comment

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

My apologies for taking so long to review, Everything seems okay. Merging now.

Thank you for your work!

@The-EDev The-EDev merged commit db7f9d9 into CrowCpp:master Jul 9, 2022
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