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

http_response.h : added custom type support #212

Merged
merged 2 commits into from
Aug 29, 2021

Conversation

hg333
Copy link
Contributor

@hg333 hg333 commented Aug 29, 2021

Added a response constructor where content-type can be specified by the user
Usage

    CROW_ROUTE(app,"/test")([](){
        std::ostringstream os;
        os<<"<First>";
        os<<"<Content>";
        os<<"Element1";
        os<<"</Content>";
        os<<"<Content>";
        os<<"Element2";
        os<<"</Content>";
        os<<"<Content>";
            os<<"<InnerContent>";
            os<<"Element3";
            os<<"</InnerContent>";
        os<<"</Content>";
        os<<"</First>";
        
        return crow::response("xml",os.str());
    });

This PR aims to fix: #48

include/crow/http_response.h Outdated Show resolved Hide resolved
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.

Thanks for your work, will merge as soon as CI is done

@The-EDev The-EDev merged commit 0a526f9 into CrowCpp:master Aug 29, 2021
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.

handler return automatically sets content-type
2 participants