Has anybody used objectMapper to parse the body of a oatpp::web::client::RequestExecutir::Response using method readBodyToDto. I am building a REST API client and I haven't been able to map the returned object into my dto. Here's the piece of code that I am struggling with:
void GoRestApi::getUser(const std::shared_ptr<GoRestApiClient>& client)
{
auto response = client->doGetUser(2600);
oatpp::String contentType = response->getHeader("Content-Type");
// auto userDto = response->readBodyToDto<oatpp::Object<UserDto>>(objectMapper);
auto data = response->readBodyToString();
OATPP_LOGD(TAG, "[doGetUser] data='%s'", data->c_str());
}
I commented out the line that I can't get even to compile. If you have some code snippet that you can share, I'd love it. Thanks a bundle.
This works fine for me