Tweaks to wxWebRequest::SetData() overload taking stream
Check that the stream is valid, if specified at all, and return false if it isn't -- or if no size was specified and determining stream size failed. Check for SetData() success in the test to provide better diagnostics in case the file it uses is not found (as is the case when running the test from another directory, for example). Also pass wxSharedPtr<> by const reference instead of by value to avoid unnecessary copies.
This commit is contained in:
@@ -245,7 +245,9 @@ public:
|
||||
this request.
|
||||
|
||||
@param dataStream
|
||||
The data in this stream will be posted as the request body
|
||||
The data in this stream will be posted as the request body. The
|
||||
stream may be empty, which will result in sending 0 bytes of data,
|
||||
but if not empty, should be valid.
|
||||
@param contentType
|
||||
The value of HTTP "Content-Type" header, e.g.
|
||||
"application/octet-stream".
|
||||
@@ -253,8 +255,11 @@ public:
|
||||
Amount of data which is sent to the server. If set to
|
||||
@c wxInvalidOffset all stream data is sent.
|
||||
|
||||
@return @false if @a dataStream is not-empty but invalid or if @a
|
||||
dataSize is not specified and the attempt to determine stream size
|
||||
failed; @true in all the other cases.
|
||||
*/
|
||||
void SetData(wxSharedPtr<wxInputStream> dataStream,
|
||||
bool SetData(const wxSharedPtr<wxInputStream>& dataStream,
|
||||
const wxString& contentType, wxFileOffset dataSize = wxInvalidOffset);
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user