NetServices: use BBorrow<BDataIO> for custom body targets
Change-Id: Ib2d4b0ca3689338d906f943295278c086c6f2c83
This commit is contained in:
@@ -114,9 +114,8 @@ namespace Network {
|
||||
\brief Represents a HTTP response body.
|
||||
|
||||
The HTTP response body is captured in this object. The body is either stored into a
|
||||
\ref target, or into a \a text variable, depending on how you called the
|
||||
\ref BHttpSession::Execute() method. If there is a \a target, the body will be empty,
|
||||
and vice versa.
|
||||
target, or into a \ref text variable, depending on how you called the
|
||||
\ref BHttpSession::Execute() method.
|
||||
|
||||
You will usually get a reference to this object through the \ref BHttpResult::Body() method.
|
||||
If you want to keep the contents of the body beyond the lifetime of the BHttpResult object,
|
||||
@@ -127,17 +126,13 @@ namespace Network {
|
||||
|
||||
|
||||
/*!
|
||||
\var std::unique_ptr<BDataIO> BHttpBody::target
|
||||
\brief An owned pointer to where the body has been written.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\var BString BHttpBody::text
|
||||
\var std::optional<BString> BHttpBody::text
|
||||
\brief A string containing the body of the HTTP request.
|
||||
|
||||
The value of this class variable is set to \c std::nullopt if the target body was written to
|
||||
a specified target. Otherwise, the response body is stored in this string. If the response
|
||||
body was empty, then this will be an empty string.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
@@ -165,14 +165,16 @@ namespace Network {
|
||||
|
||||
/*!
|
||||
\fn BHttpResult BHttpSession::Execute(BHttpRequest &&request,
|
||||
std::unique_ptr< BDataIO > target=nullptr, BMessenger observer=BMessenger())
|
||||
BBorrow< BDataIO > target=nullptr, BMessenger observer=BMessenger())
|
||||
\brief Schedule and execute a \a request.
|
||||
|
||||
\param request The (valid) request to move from.
|
||||
\param target An optional data buffer to write the incoming body of the request to. This can be
|
||||
\c nullptr if you want to use the default internal storage. If you provide a buffer, it
|
||||
must be wrapped in a \c std::unique_ptr. This means that you transfer ownership to the
|
||||
session. After the request is finished, you can regain ownership.
|
||||
must be wrapped in a \ref BBorrow object. This means that you exclusively borrow the
|
||||
target to this session object. After the request is finished, you can regain usage of the
|
||||
object through the matching \ref BExclusiveBorrow object. Use the \ref BHttpResult::Body()
|
||||
method to synchronize when the target is available again.
|
||||
\param observer An optional observer that will receive the progress and status messages for
|
||||
this request.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user