HttpSettingsExtensions Class

Summary

Contains functionality related to HTTP settings.
Assembly
Cake.Http.dll
Namespace
Cake.Http
Base Types
  • Object
graph BT Type-->Base0["Object"] Type["HttpSettingsExtensions"] class Type type-node

Syntax

public static class HttpSettingsExtensions

Methods

Name Value Summary
AppendCookie(HttpSettings, string, string) HttpSettings
Appends the cookie to the settings cookie collection
static
AppendHeader(HttpSettings, string, string) HttpSettings
Appends the header to the settings header collection
static
EnsureSuccessStatusCode(HttpSettings, bool) HttpSettings
Sets the EnsureSuccessStatusCode to true. This makes the httpclient throw an error if it does not return a 200 range status.
static
SetAccept(HttpSettings, string) HttpSettings
Sets the accept header of the request.
static
SetAcceptLanguage(HttpSettings, string) HttpSettings
Sets the "Accept-Language" header of the request.
static
SetAuthorization(HttpSettings, string, string) HttpSettings
Adds a Authorization Header to the request.
static
SetContentType(HttpSettings, string) HttpSettings
Sets the content-type of the request
static
SetFormUrlEncodedRequestBody(HttpSettings, IDictionary<string, string>) HttpSettings
Sets the request body as form url encoded. Only valid for Http Methods that allow a request body. Any existing content in the RequestBody is overridden.
static
SetFormUrlEncodedRequestBody(HttpSettings, IEnumerable<KeyValuePair<string, string>>) HttpSettings
Sets the request body as form url encoded. Only valid for Http Methods that allow a request body. Any existing content in the RequestBody is overridden. Accepts multiple parameters with the same key.
static
SetJsonRequestBody<T>(HttpSettings, T, bool) HttpSettings
Sets the request body from an object. Serialized as JSON
static
SetMultipartFormDataRequestBody(HttpSettings, IEnumerable<KeyValuePair<string, string>>, IEnumerable<FilePath>) HttpSettings
Sets the request body as form url encoded. Only valid for Http Methods that allow a request body. Any existing content in the RequestBody is overridden. Accepts multiple parameters with the same key. This can be used to post files to a remote URL
static
SetMultipartFormDataRequestBody(HttpSettings, IEnumerable<KeyValuePair<string, string>>, IEnumerable<KeyValuePair<string, FilePath>>) HttpSettings
Sets the request body as form url encoded. Only valid for Http Methods that allow a request body. Any existing content in the RequestBody is overridden. Accepts multiple parameters with the same key. This can be used to post files to a remote URL
static
SetNoCache(HttpSettings) HttpSettings
Appends a Cache-Control header with no-store
static
SetOrigin(HttpSettings, string) HttpSettings
Sets the origin header to initiate a request for cross-origin resource sharing (asks server for an 'Access-Control-Allow-Origin' response field).
static
SetReferer(HttpSettings, string) HttpSettings
Sets the "Referer" header of the address of the previous web page from which a link to the currently requested page was followed.
static
SetRequestBody(HttpSettings, string) HttpSettings
Sets the request body from a string input
static
SetTimeout(HttpSettings, TimeSpan) HttpSettings
Sets the timeout for the http request
static
SuppressLogResponseRequestBodyOutput(HttpSettings) HttpSettings
Supresses logging to the console
static
UseBasicAuthorization(HttpSettings, string, string) HttpSettings
Adds a "Basic" Authorization Header to the request.
static
UseBearerAuthorization(HttpSettings, string) HttpSettings
Adds a "Bearer" Token Authorization Header to the request. Used when authorization against a resource that uses OAUTH2
static
UseClientCertificates(HttpSettings, IEnumerable<X509Certificate2>) HttpSettings
Adds client certificate(s) to the http handler.
static
UseClientCertificates(HttpSettings, X509Certificate2[]) HttpSettings
Adds client certificate(s) to the http handler.
static

Extension Methods

Name Value Summary
ToDictionary() IDictionary<string, object>
Requires the Cake.DeployParams addin
ToStringWithNullMarkup() string
Requires the Cake.Issues addin