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
Type | Name |
---|---|
System.Net.WebRequest | client |
System.String | userName |
System.String | password |
AddApiKeyAuth(WebRequest, String)
View Source
Declaration
public static void AddApiKeyAuth(this WebRequest client, string apiKey)
Parameters
Type | Name |
---|---|
System.Net.WebRequest | client |
System.String | apiKey |
AddBearerToken(WebRequest, String)
View Source
Declaration
public static void AddBearerToken(this WebRequest client, string bearerToken)
Parameters
Type | Name |
---|---|
System.Net.WebRequest | client |
System.String | bearerToken |
CalculateMD5Hash(String)
View Source
Declaration
public static string CalculateMD5Hash(string input)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | input |
GetResponseDtoName(Type)
View Source
Declaration
public static string GetResponseDtoName(Type requestType)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Type | requestType |
GetErrorResponseDtoType<TResponse>(Object)
View Source
Declaration
public static Type GetErrorResponseDtoType<TResponse>(object request)
Returns
System.Type
Parameters
Type | Name |
---|---|
System.Object | request |
Type Parameters
TResponse
GetErrorResponseDtoType(Object)
View Source
Declaration
public static Type GetErrorResponseDtoType(object request)
Returns
System.Type
Parameters
Type | Name |
---|---|
System.Object | request |
GetErrorResponseDtoType(Type)
View Source
Declaration
public static Type GetErrorResponseDtoType(Type requestType)
Returns
System.Type
Parameters
Type | Name |
---|---|
System.Type | requestType |
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
Parameters
Type | Name |
---|---|
System.Object | response |
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
Type | Name |
---|---|
System.String | url |
System.String | method |
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
Type | Name |
---|---|
System.Net.HttpWebRequest | webReq |
System.Text.StringBuilder | sb |
System.Uri | baseUri |
AppendHttpResponseHeaders(HttpWebResponse, StringBuilder)
View Source
Declaration
public static void AppendHttpResponseHeaders(this HttpWebResponse webRes, StringBuilder sb)
Parameters
Type | Name |
---|---|
System.Net.HttpWebResponse | webRes |
System.Text.StringBuilder | sb |