Skip to main content

HttpResultUtils

Assembly: ServiceStack.dll​
View Source​
Declaration
public static class HttpResultUtils

Methods​

GetDto(Object)​

Shortcut to get the ResponseDTO whether it's bare or inside a IHttpResult

View Source​
Declaration
public static object GetDto(this object response)
Returns​

System.Object

Parameters​
TypeName
System.Objectresponse

GetResponseDto(Object)​

Alias of AsDto

View Source​
Declaration
public static object GetResponseDto(this object response)
Returns​

System.Object

Parameters​
TypeName
System.Objectresponse

GetDto<TResponse>(Object)​

Shortcut to get the ResponseDTO whether it's bare or inside a IHttpResult

View Source​
Declaration
public static TResponse GetDto<TResponse>(this object response)
where TResponse : class
Returns​

<TResponse>: TResponse if found; otherwise null

Parameters​
TypeName
System.Objectresponse
Type Parameters​
  • TResponse

GetResponseDto<TResponse>(Object)​

Alias of AsDto

View Source​
Declaration
public static TResponse GetResponseDto<TResponse>(this object response)
where TResponse : class
Returns​

<TResponse>

Parameters​
TypeName
System.Objectresponse
Type Parameters​
  • TResponse

CreateErrorResponse(IHttpError)​

View Source​
Declaration
public static object CreateErrorResponse(this IHttpError httpError)
Returns​

System.Object

Parameters​
TypeName
ServiceStack.Web.IHttpErrorhttpError

IsErrorResponse(Object)​

Whether the response is an IHttpError or Exception or ErrorResponse

View Source​
Declaration
public static bool IsErrorResponse(this object response)
Returns​

System.Boolean

Parameters​
TypeName
System.Objectresponse

ExtractHttpRanges(String, Int64, out Int64, out Int64)​

rangeHeader should be of the format "bytes=0-" or "bytes=0-12345" or "bytes=123-456"

View Source​
Declaration
public static void ExtractHttpRanges(this string rangeHeader, long contentLength, out long rangeStart, out long rangeEnd)
Parameters​
TypeName
System.StringrangeHeader
System.Int64contentLength
System.Int64rangeStart
System.Int64rangeEnd

AddHttpRangeResponseHeaders(IResponse, Int64, Int64, Int64)​

Adds 206 PartialContent Status, Content-Range and Content-Length headers

View Source​
Declaration
public static void AddHttpRangeResponseHeaders(this IResponse response, long rangeStart, long rangeEnd, long contentLength)
Parameters​
TypeName
ServiceStack.Web.IResponseresponse
System.Int64rangeStart
System.Int64rangeEnd
System.Int64contentLength