oat++

How to response with MIME code on oat++ endpoint


How do I set the MIME code on a endpoint response?

I see no documentation about that available.


Solution

  • You just have to add a Content-Type header to the response:

    auto response = createResponse(Status::CODE_200, "OK");
    response->putHeader("Content-Type", "image/jpeg");
    return response;