Skip to main content

WebRequestUtils

Assembly: ServiceStack.Client.dll
View Source
Declaration
public static class WebRequestUtils

Fields

ResponseDtoSuffix

Naming convention for the request's Response DTO

View Source
Declaration
public const string ResponseDtoSuffix = "Response"

Methods

AddBasicAuth(WebRequest, String, String)

View Source
Declaration
public static void AddBasicAuth(this WebRequest client, string userName, string password)
Parameters
TypeName
System.Net.WebRequestclient
System.StringuserName
System.Stringpassword

AddApiKeyAuth(WebRequest, String)

View Source
Declaration
public static void AddApiKeyAuth(this WebRequest client, string apiKey)
Parameters
TypeName
System.Net.WebRequestclient
System.StringapiKey

AddBearerToken(WebRequest, String)

View Source
Declaration
public static void AddBearerToken(this WebRequest client, string bearerToken)
Parameters
TypeName
System.Net.WebRequestclient
System.StringbearerToken

CalculateMD5Hash(String)

View Source
Declaration
public static string CalculateMD5Hash(string input)
Returns

System.String

Parameters
TypeName
System.Stringinput

GetResponseDtoName(Type)

View Source
Declaration
public static string GetResponseDtoName(Type requestType)
Returns

System.String

Parameters
TypeName
System.TyperequestType

GetErrorResponseDtoType<TResponse>(Object)

View Source
Declaration
public static Type GetErrorResponseDtoType<TResponse>(object request)
Returns

System.Type

Parameters
TypeName
System.Objectrequest
Type Parameters
  • TResponse

GetErrorResponseDtoType(Object)

View Source
Declaration
public static Type GetErrorResponseDtoType(object request)
Returns

System.Type

Parameters
TypeName
System.Objectrequest

GetErrorResponseDtoType(Type)

View Source
Declaration
public static Type GetErrorResponseDtoType(Type requestType)
Returns

System.Type

Parameters
TypeName
System.TyperequestType

GetResponseStatus(Object)

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

View Source
Declaration
public static ResponseStatus GetResponseStatus(this object response)
Returns

ServiceStack.ResponseStatus

Parameters
TypeName
System.Objectresponse

InitWebRequest(String, String, Dictionary<String, String>)

View Source
Declaration
public static HttpWebRequest InitWebRequest(string url, string method = "GET", Dictionary<string, string> headers = null)
Returns

System.Net.HttpWebRequest

Parameters
TypeName
System.Stringurl
System.Stringmethod
System.Collections.Generic.Dictionary<System.String,System.String>headers

AppendHttpRequestHeaders(HttpWebRequest, StringBuilder, Uri)

View Source
Declaration
public static void AppendHttpRequestHeaders(this HttpWebRequest webReq, StringBuilder sb, Uri baseUri = null)
Parameters
TypeName
System.Net.HttpWebRequestwebReq
System.Text.StringBuildersb
System.UribaseUri

AppendHttpResponseHeaders(HttpWebResponse, StringBuilder)

View Source
Declaration
public static void AppendHttpResponseHeaders(this HttpWebResponse webRes, StringBuilder sb)
Parameters
TypeName
System.Net.HttpWebResponsewebRes
System.Text.StringBuildersb