Callbacks

Response (HttpResponseMessage)

Contains the whole or partial response from the server based on the HttpCompletionOption

  • If the HttpCompletionOption is set to AllResponseContent or there is no HttpCompletionOption the HttpResponseMessage callback will be raised once when the download completes
  • If the HttpCompletionOption is set to StreamResponseContent the HttpResponseMessage callback will be raised perodically when DownloadBlockSize bytes of data have been downloaded or when all data has been read
  • If an exception is raised it will be contained in the Exception property

HttpResponseMessage Properties

PropertyDescription
OriginalRequestThe core request object if additional information is required - might be null if an exception is raised
OriginalResponseThe core response object if additional information is required - might be null if an exception is raised
ContentLengthThe length of the content which the server intends to send - could be -1 if the server doesn't send a content length header
TotalContentReadHow much data has been read so far
ContentReadThisRoundContent read since the last callback was raised
PercentageCompletePercentage completion of the download
StatusCodeThe http status code
ReasonPhraseThe reason for the http status code
IsSuccessStatusCodeCan the status code be considered a success code
ExceptionThe exception raised if there was one, null otherwise
HasContentDid the server return any content

HttpResponseMessage Methods

MethodDescription
ReadAsString()Returns the response as a string
ReadAsString(encoding)Returns the response as a string using the specified encoding
ReadAsByteArray()Returns the response as a byte array
ReadAsStream()Returns the response as a stream
ReadAsJson()Deserialises the json response and returns the resulting object

UploadStatus (UploadStatusMessage)

Contains the progress of an upload, the UploadStatus callback does not need to be specified if you don't require upload progress. Will be raised perodically when UploadBlockSize bytes of data have been uploaded or when all data has been uploaded

UploadStatusMessage Properties

PropertyDescription
ContentLengthThe length of the content to be uploaded
TotalContentUploadedHow much data has been written so far
ContentUploadedThisRoundContent uploaded since the last callback was raised
PercentageCompletePercentage completion of the upload