Update 1.3.0.md

This commit is contained in:
Leonid Stryzhevskyi 2021-10-27 01:39:21 +03:00 committed by GitHub
parent bc3d17750d
commit cce1befde1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ Contents:
- [Request Data Bundle](#request-data-bundle)
- [ConnectionProviderSwitch](#connectionproviderswitch)
- [Proper Server Stoppage](#proper-server-stoppage)
- [TemporaryFile](#temporaryfile)
- [Response::getBody()](#responsegetbody)
- [data::stream::FIFOStream](#datastreamfifostream)
- [data::stream::BufferedInputStream](#datastreambufferedinputstream)
@ -240,6 +241,30 @@ Fix to [#476](https://github.com/oatpp/oatpp/issues/476), [#269](https://github.
Now call to `HttpConnectionHandler::stop()`, `AsyncHttpConnectionHandler::stop()` will shutdown all opened connections and will wait until all request handlers exit.
## TemporaryFile
Introduce `oatpp::data::share::TemporaryFile`.
Use-case:
Temporary file resolves concurrency issues during file uploads.
Also, a temporary file ensures that partially uploaded (due to errors/exceptions) resources will be automatically deleted at the end of the block.
```cpp
ENDPOINT("POST", "/upload", upload,
REQUEST(std::shared_ptr<IncomingRequest>, request))
{
oatpp::data::share::TemporaryFile tmp("/tmp"); // create random file in '/tmp' folder
auto stream = tmp.openOutputStream();
request->transferBody(&stream); // transfer body to temporary file
tmp.moveFile("/path/to/permanent/storage/avatar.png"); // move file to permanent storage
return createResponse(Status::CODE_200, "OK");
}
```
## Response::getBody()
`oatpp::web::protocol::http::outgoing::Response` has a new method `getBody()` to retreive the body of the response.