[CPPREST] Fixed multipart files upload implementation (#6518)

This commit is contained in:
Vlad Frolov
2017-09-29 10:46:16 +03:00
committed by wing328
parent 8e854dc744
commit 924a8e5efe
7 changed files with 6 additions and 69 deletions

View File

@@ -112,10 +112,10 @@ pplx::task<web::http::http_response> ApiClient::callApi(
uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second));
}
std::stringstream data;
postBody->writeTo(data);
uploadData.writeTo(data);
auto bodyString = data.str();
auto length = bodyString.size();
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, contentType);
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, U("multipart/form-data; boundary=") + uploadData.getBoundary());
}
else
{