Axios Class
Default shared client, mirroring the axios top-level API:
await Axios.Get<User>("https://api.test/users/1").
public static class Axios
Inheritance System.Object → Axios
Properties
Axios.Defaults Property
Defaults applied to every request sent through the shared client.
public static AxiosNet.Config.AxiosRequestConfig Defaults { get; }
Property Value
Axios.Interceptors Property
Interceptors of the shared client.
public static AxiosNet.Interceptors.AxiosInterceptors Interceptors { get; }
Property Value
Axios.Version Property
Library version.
public static string Version { get; }
Property Value
Methods
Axios.All<T>(Task<T>[]) Method
Waits for every request, like axios.all.
public static System.Threading.Tasks.Task<T[]> All<T>(params System.Threading.Tasks.Task<T>[] requests);
Type parameters
T
Parameters
requests System.Threading.Tasks.Task<T>[]
Returns
System.Threading.Tasks.Task<T[]>
Axios.Create(AxiosRequestConfig, HttpMessageHandler) Method
Creates an isolated client with its own defaults and interceptors.
public static AxiosNet.Client.AxiosClient Create(AxiosNet.Config.AxiosRequestConfig? config=null, System.Net.Http.HttpMessageHandler? handler=null);
Parameters
config AxiosRequestConfig
handler System.Net.Http.HttpMessageHandler
Returns
Axios.Delete<T>(string, AxiosRequestConfig) Method
Sends a DELETE request.
public static System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>> Delete<T>(string url, AxiosNet.Config.AxiosRequestConfig? config=null);
Type parameters
T
Type the response body is read as.
Parameters
url System.String
Absolute URL, or relative to BaseUrl.
config AxiosRequestConfig
Config merged over the defaults for this request.
Returns
System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>>
Axios.Get<T>(string, AxiosRequestConfig) Method
Sends a GET request.
public static System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>> Get<T>(string url, AxiosNet.Config.AxiosRequestConfig? config=null);
Type parameters
T
Type the response body is read as.
Parameters
url System.String
Absolute URL, or relative to BaseUrl.
config AxiosRequestConfig
Config merged over the defaults for this request.
Returns
System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>>
Axios.GetUri(AxiosRequestConfig) Method
Returns the final URL for config without sending a request.
public static string GetUri(AxiosNet.Config.AxiosRequestConfig? config=null);
Parameters
config AxiosRequestConfig
Returns
Axios.Head<T>(string, AxiosRequestConfig) Method
Sends a HEAD request.
public static System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>> Head<T>(string url, AxiosNet.Config.AxiosRequestConfig? config=null);
Type parameters
T
Type the response body is read as.
Parameters
url System.String
Absolute URL, or relative to BaseUrl.
config AxiosRequestConfig
Config merged over the defaults for this request.
Returns
System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>>
Axios.IsAxiosError(object) Method
True when error comes from axios (any AxiosException).
public static bool IsAxiosError(object? error);
Parameters
error System.Object
Returns
Axios.IsCancel(object) Method
True when the request was canceled through its cancellation token.
public static bool IsCancel(object? error);
Parameters
error System.Object
Returns
Axios.MergeConfig(AxiosRequestConfig, AxiosRequestConfig) Method
Merges two configs; overrides wins, headers and params are merged key by key.
public static AxiosNet.Config.AxiosRequestConfig MergeConfig(AxiosNet.Config.AxiosRequestConfig config, AxiosNet.Config.AxiosRequestConfig? overrides);
Parameters
config AxiosRequestConfig
overrides AxiosRequestConfig
Returns
Axios.Options<T>(string, AxiosRequestConfig) Method
Sends an OPTIONS request.
public static System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>> Options<T>(string url, AxiosNet.Config.AxiosRequestConfig? config=null);
Type parameters
T
Type the response body is read as.
Parameters
url System.String
Absolute URL, or relative to BaseUrl.
config AxiosRequestConfig
Config merged over the defaults for this request.
Returns
System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>>
Axios.Patch<T>(string, object, AxiosRequestConfig) Method
Sends a PATCH request.
public static System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>> Patch<T>(string url, object? data=null, AxiosNet.Config.AxiosRequestConfig? config=null);
Type parameters
T
Type the response body is read as.
Parameters
url System.String
Absolute URL, or relative to BaseUrl.
data System.Object
Request body, serialized according to its type.
config AxiosRequestConfig
Config merged over the defaults for this request.
Returns
System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>>
Axios.PatchForm<T>(string, object, AxiosRequestConfig) Method
Sends a PATCH request with Content-Type: multipart/form-data.
public static System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>> PatchForm<T>(string url, object? data=null, AxiosNet.Config.AxiosRequestConfig? config=null);
Type parameters
T
Type the response body is read as.
Parameters
url System.String
Absolute URL, or relative to BaseUrl.
data System.Object
Request body, serialized according to its type.
config AxiosRequestConfig
Config merged over the defaults for this request.
Returns
System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>>
Axios.Post<T>(string, object, AxiosRequestConfig) Method
Sends a POST request.
public static System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>> Post<T>(string url, object? data=null, AxiosNet.Config.AxiosRequestConfig? config=null);
Type parameters
T
Type the response body is read as.
Parameters
url System.String
Absolute URL, or relative to BaseUrl.
data System.Object
Request body, serialized according to its type.
config AxiosRequestConfig
Config merged over the defaults for this request.
Returns
System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>>
Axios.PostForm<T>(string, object, AxiosRequestConfig) Method
Sends a POST request with Content-Type: multipart/form-data.
public static System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>> PostForm<T>(string url, object? data=null, AxiosNet.Config.AxiosRequestConfig? config=null);
Type parameters
T
Type the response body is read as.
Parameters
url System.String
Absolute URL, or relative to BaseUrl.
data System.Object
Request body, serialized according to its type.
config AxiosRequestConfig
Config merged over the defaults for this request.
Returns
System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>>
Axios.Put<T>(string, object, AxiosRequestConfig) Method
Sends a PUT request.
public static System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>> Put<T>(string url, object? data=null, AxiosNet.Config.AxiosRequestConfig? config=null);
Type parameters
T
Type the response body is read as.
Parameters
url System.String
Absolute URL, or relative to BaseUrl.
data System.Object
Request body, serialized according to its type.
config AxiosRequestConfig
Config merged over the defaults for this request.
Returns
System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>>
Axios.PutForm<T>(string, object, AxiosRequestConfig) Method
Sends a PUT request with Content-Type: multipart/form-data.
public static System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>> PutForm<T>(string url, object? data=null, AxiosNet.Config.AxiosRequestConfig? config=null);
Type parameters
T
Type the response body is read as.
Parameters
url System.String
Absolute URL, or relative to BaseUrl.
data System.Object
Request body, serialized according to its type.
config AxiosRequestConfig
Config merged over the defaults for this request.
Returns
System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>>
Axios.Request<T>(AxiosRequestConfig) Method
Sends a request fully described by config.
public static System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>> Request<T>(AxiosNet.Config.AxiosRequestConfig config);
Type parameters
T
Type the response body is read as.
Parameters
config AxiosRequestConfig
The request, merged over the defaults.
Returns
System.Threading.Tasks.Task<AxiosNet.Models.AxiosResponse<T>>
Axios.ToFormData(object, AxiosFormSerializer) Method
Serializes an object into multipart form data, like axios.toFormData.
public static System.Net.Http.MultipartFormDataContent ToFormData(object data, AxiosNet.Config.AxiosFormSerializer? options=null);
Parameters
data System.Object
options AxiosFormSerializer