Skip to main content

AxiosRequestConfig Class

Axios.Net › AxiosNet.Config

Configuration of a request. Used both as client defaults and per request. Merge order: library defaults, then client defaults, then the request config.

public class AxiosRequestConfig

Inheritance System.Object → AxiosRequestConfig

Properties​

AxiosRequestConfig.AllowAbsoluteUrls Property​

When false, absolute URLs are still prefixed by BaseUrl. Defaults to true.

public System.Nullable<bool> AllowAbsoluteUrls { get; set; }

Property Value​

System.Nullable<System.Boolean>

AxiosRequestConfig.Auth Property​

Sets a Basic Authorization header, overwriting any custom one.

public System.Nullable<(string Username,string Password)> Auth { get; set; }

Property Value​

System.Nullable<<System.String,System.String>>

AxiosRequestConfig.BaseUrl Property​

Prepended to Url unless it is absolute.

public string? BaseUrl { get; set; }

Property Value​

System.String

AxiosRequestConfig.CancellationToken Property​

Cancels the request (axios' signal).

public System.Threading.CancellationToken CancellationToken { get; set; }

Property Value​

System.Threading.CancellationToken

AxiosRequestConfig.CommonHeaders Property​

Shortcut for MethodHeaders["common"].

public AxiosNet.Models.AxiosHeaders CommonHeaders { get; }

Property Value​

AxiosHeaders

AxiosRequestConfig.Data Property​

Request body, never inherited from defaults. A string is sent as is, a byte[] or Stream as binary, an System.Net.Http.HttpContent as is, anything else as JSON, or urlencoded / multipart when the Content-Type header asks for it.

public object? Data { get; set; }

Property Value​

System.Object

AxiosRequestConfig.Decompress Property​

Automatically decompress gzip, deflate and brotli responses. Defaults to true. Needs the built-in handler.

public System.Nullable<bool> Decompress { get; set; }

Property Value​

System.Nullable<System.Boolean>

AxiosRequestConfig.FormSerializer Property​

Controls how object bodies are serialized as multipart/form-data or application/x-www-form-urlencoded.

public AxiosNet.Config.AxiosFormSerializer? FormSerializer { get; set; }

Property Value​

AxiosFormSerializer

AxiosRequestConfig.Headers Property​

Headers sent with this request (override MethodHeaders).

public AxiosNet.Models.AxiosHeaders Headers { get; set; }

Property Value​

AxiosHeaders

AxiosRequestConfig.MaxBodyLength Property​

Maximum request body size in bytes, -1 for unlimited, when the length is known.

public System.Nullable<long> MaxBodyLength { get; set; }

Property Value​

System.Nullable<System.Int64>

AxiosRequestConfig.MaxContentLength Property​

Maximum response size in bytes, -1 for unlimited. Exceeding it throws ERR_BAD_RESPONSE.

public System.Nullable<long> MaxContentLength { get; set; }

Property Value​

System.Nullable<System.Int64>

AxiosRequestConfig.MaxRedirects Property​

Maximum redirects followed; 0 disables redirects. Needs the built-in handler.

public System.Nullable<int> MaxRedirects { get; set; }

Property Value​

System.Nullable<System.Int32>

AxiosRequestConfig.Method Property​

HTTP method, GET when unset.

public System.Net.Http.HttpMethod? Method { get; set; }

Property Value​

System.Net.Http.HttpMethod

AxiosRequestConfig.MethodHeaders Property​

Default headers per lowercase method name, plus "common" applied to every request (axios' defaults.headers.common / defaults.headers.post).

public System.Collections.Generic.Dictionary<string,AxiosNet.Models.AxiosHeaders> MethodHeaders { get; set; }

Property Value​

System.Collections.Generic.Dictionary<System.String,AxiosHeaders>

AxiosRequestConfig.OnDownloadProgress Property​

Called as the response body is received.

public System.Action<AxiosNet.Models.AxiosProgressEvent>? OnDownloadProgress { get; set; }

Property Value​

System.Action<AxiosProgressEvent>

AxiosRequestConfig.OnUploadProgress Property​

Called as the request body is sent.

public System.Action<AxiosNet.Models.AxiosProgressEvent>? OnUploadProgress { get; set; }

Property Value​

System.Action<AxiosProgressEvent>

AxiosRequestConfig.Params Property​

Query string parameters. Null values are skipped; arrays and nested objects follow ParamsSerializer.

public System.Collections.Generic.Dictionary<string,object?> Params { get; set; }

Property Value​

System.Collections.Generic.Dictionary<System.String,System.Object>

AxiosRequestConfig.ParamsSerializer Property​

Controls how Params are turned into a query string.

public AxiosNet.Config.AxiosParamsSerializer? ParamsSerializer { get; set; }

Property Value​

AxiosParamsSerializer

AxiosRequestConfig.Proxy Property​

Proxy settings; Disabled ignores system proxies. Needs the built-in handler.

public AxiosNet.Config.AxiosProxy? Proxy { get; set; }

Property Value​

AxiosProxy

AxiosRequestConfig.Redact Property​

Config keys masked (case-insensitive, recursive) by ToJSON().

public System.Collections.Generic.List<string>? Redact { get; set; }

Property Value​

System.Collections.Generic.List<System.String>

AxiosRequestConfig.ResponseEncoding Property​

Encoding used to decode the body. Defaults to the response charset, then UTF-8.

public System.Text.Encoding? ResponseEncoding { get; set; }

Property Value​

System.Text.Encoding

AxiosRequestConfig.ResponseType Property​

Inferred from T when unset (string, byte[], Stream, otherwise JSON).

public System.Nullable<AxiosNet.Config.AxiosResponseType> ResponseType { get; set; }

Property Value​

System.Nullable<AxiosResponseType>

AxiosRequestConfig.Timeout Property​

Aborts the request when exceeded. Unset or zero means no timeout.

public System.Nullable<System.TimeSpan> Timeout { get; set; }

Property Value​

System.Nullable<System.TimeSpan>

AxiosRequestConfig.TransformRequest Property​

Runs on Data before it is turned into content; may edit the headers.

public System.Collections.Generic.List<System.Func<object?,AxiosNet.Models.AxiosHeaders,object?>>? TransformRequest { get; set; }

Property Value​

System.Collections.Generic.List<System.Func<System.Object,AxiosHeaders,System.Object>>

AxiosRequestConfig.TransformResponse Property​

Runs on the raw body (string, or byte[] for Bytes) before it is converted to T. Arguments: data, response headers, status.

public System.Collections.Generic.List<System.Func<object?,AxiosNet.Models.AxiosHeaders,int,object?>>? TransformResponse { get; set; }

Property Value​

System.Collections.Generic.List<System.Func<System.Object,AxiosHeaders,System.Int32,System.Object>>

AxiosRequestConfig.Transitional Property​

Behaviors kept for compatibility with older axios versions.

public AxiosNet.Config.AxiosTransitional? Transitional { get; set; }

Property Value​

AxiosTransitional

AxiosRequestConfig.Url Property​

Server URL, absolute or relative to BaseUrl.

public string? Url { get; set; }

Property Value​

System.String

AxiosRequestConfig.ValidateStatus Property​

Decides whether a status code resolves (true) or throws (false). Defaults to 2xx.

public System.Func<int,bool>? ValidateStatus { get; set; }

Property Value​

System.Func<System.Int32,System.Boolean>