mirror of
https://github.com/oatpp/oatpp.git
synced 2025-02-11 17:20:52 +08:00
Introduce transferBody(WriteCallback) methods for Incoming Request.
This commit is contained in:
parent
a0a8223fb7
commit
a032358614
@ -105,6 +105,10 @@ oatpp::String Request::getPathTail() const {
|
||||
return m_pathVariables.getTail();
|
||||
}
|
||||
|
||||
void Request::transferBody(data::stream::WriteCallback* writeCallback) const {
|
||||
m_bodyDecoder->decode(m_headers, m_bodyStream.get(), writeCallback);
|
||||
}
|
||||
|
||||
void Request::transferBodyToStream(oatpp::data::stream::OutputStream* toStream) const {
|
||||
m_bodyDecoder->decodeToStream(m_headers, m_bodyStream.get(), toStream);
|
||||
}
|
||||
@ -113,8 +117,16 @@ oatpp::String Request::readBodyToString() const {
|
||||
return m_bodyDecoder->decodeToString(m_headers, m_bodyStream.get());
|
||||
}
|
||||
|
||||
oatpp::async::CoroutineStarter Request::transferBodyToStreamAsync(const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const {
|
||||
async::CoroutineStarter Request::transferBodyAsync(const std::shared_ptr<data::stream::AsyncWriteCallback>& writeCallback) const {
|
||||
return m_bodyDecoder->decodeAsync(m_headers, m_bodyStream, writeCallback);
|
||||
}
|
||||
|
||||
async::CoroutineStarter Request::transferBodyToStreamAsync(const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const {
|
||||
return m_bodyDecoder->decodeToStreamAsync(m_headers, m_bodyStream, toStream);
|
||||
}
|
||||
|
||||
async::CoroutineStarterForResult<const oatpp::String&> Request::readBodyToStringAsync() const {
|
||||
return m_bodyDecoder->decodeToStringAsync(m_headers, m_bodyStream);
|
||||
}
|
||||
|
||||
}}}}}
|
@ -149,6 +149,13 @@ public:
|
||||
*/
|
||||
oatpp::String getPathTail() const;
|
||||
|
||||
/**
|
||||
* Transfer body. <br>
|
||||
* Read body chunk by chunk and pass chunks to the `writeCallback`.
|
||||
* @param writeCallback - &id:oatpp::data::stream::WriteCallback;.
|
||||
*/
|
||||
void transferBody(data::stream::WriteCallback* writeCallback) const;
|
||||
|
||||
/**
|
||||
* Stream content of the body-stream to toStream
|
||||
* @param toStream
|
||||
@ -187,6 +194,14 @@ public:
|
||||
|
||||
// Async
|
||||
|
||||
/**
|
||||
* Transfer body in Asynchronous manner. <br>
|
||||
* Read body chunk by chunk and pass chunks to the `writeCallback`.
|
||||
* @param writeCallback - `std::shared_ptr` to &id:oatpp::data::stream::AsyncWriteCallback;.
|
||||
* @return - &id:oatpp::async::CoroutineStarter;.
|
||||
*/
|
||||
async::CoroutineStarter transferBodyAsync(const std::shared_ptr<data::stream::AsyncWriteCallback>& writeCallback) const;
|
||||
|
||||
/**
|
||||
* Transfer body stream to toStream Async
|
||||
* @param toStream
|
||||
@ -198,9 +213,7 @@ public:
|
||||
* Transfer body stream to string Async.
|
||||
* @return - &id:oatpp::async::CoroutineStarterForResult;.
|
||||
*/
|
||||
oatpp::async::CoroutineStarterForResult<const oatpp::String&> readBodyToStringAsync() const {
|
||||
return m_bodyDecoder->decodeToStringAsync(m_headers, m_bodyStream);
|
||||
}
|
||||
async::CoroutineStarterForResult<const oatpp::String&> readBodyToStringAsync() const;
|
||||
|
||||
/**
|
||||
* Transfer body to String and parse it as DTO
|
||||
|
Loading…
Reference in New Issue
Block a user