Class ResponseMessage
Represents a response from the Azure Cosmos DB service.
public class ResponseMessage : IDisposable
- Inheritance
-
ResponseMessage
- Implements
- Inherited Members
- Extension Methods
Constructors
ResponseMessage()
Create a ResponseMessage
public ResponseMessage()
ResponseMessage(HttpStatusCode, RequestMessage, string)
Create a ResponseMessage
public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage = null, string errorMessage = null)
Parameters
statusCode
HttpStatusCodeThe HttpStatusCode of the response
requestMessage
RequestMessageThe RequestMessage object
errorMessage
stringThe reason for failures if any.
Properties
Content
Gets the content as a Stream, if any, of the current response.
public virtual Stream Content { get; set; }
Property Value
ContinuationToken
Gets the Continuation Token in the current ResponseMessage.
public virtual string ContinuationToken { get; }
Property Value
Remarks
This is only used in feed operations like query and change feed
Diagnostics
Gets or sets the cosmos diagnostic information for the current request to Azure Cosmos DB service
public virtual CosmosDiagnostics Diagnostics { get; set; }
Property Value
ErrorMessage
Gets the reason for a failure in the current response.
public virtual string ErrorMessage { get; }
Property Value
Headers
Gets the current ResponseMessage HTTP headers.
public virtual Headers Headers { get; }
Property Value
IndexMetrics
Gets the Index Metrics in the current ResponseMessage to be used for debugging purposes. It's applicable to query response only. Other feed response will return null for this field. This result is only available if QueryRequestOptions.PopulateIndexMetrics is set to true.
public string IndexMetrics { get; }
Property Value
- string
The index utilization metrics.
IsSuccessStatusCode
Asserts if the current HttpStatusCode is a success.
public virtual bool IsSuccessStatusCode { get; }
Property Value
RequestMessage
Gets the original request message
public virtual RequestMessage RequestMessage { get; }
Property Value
StatusCode
Gets the HttpStatusCode of the current response.
public virtual HttpStatusCode StatusCode { get; }
Property Value
Methods
Dispose()
Disposes the current ResponseMessage.
public void Dispose()
Dispose(bool)
Dispose of the response message content
protected virtual void Dispose(bool disposing)
Parameters
disposing
boolTrue to dispose of content
EnsureSuccessStatusCode()
Checks if the current ResponseMessage has a successful status code, otherwise, throws.
public virtual ResponseMessage EnsureSuccessStatusCode()
Returns
- ResponseMessage
The current ResponseMessage.
Exceptions
- CosmosException
An instance of CosmosException representing the error state.