Axios.Net 0.1.0

dotnet add package Axios.Net --version 0.1.0
                    
NuGet\Install-Package Axios.Net -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Axios.Net" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Axios.Net" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Axios.Net" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Axios.Net --version 0.1.0
                    
#r "nuget: Axios.Net, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Axios.Net@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Axios.Net&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Axios.Net&version=0.1.0
                    
Install as a Cake Tool

Axios.Net

A .NET HTTP client with an axios-like syntax.

Installation

Axios.Net targets .NET 8 and .NET 10.

dotnet add package Axios.Net

Or add it to your project file:

<PackageReference Include="Axios.Net" Version="0.1.0" />

Quick start

using AxiosNet.Client;   // Axios, AxiosClient
using AxiosNet.Config;   // AxiosRequestConfig, AxiosProxy, ...
using AxiosNet.Errors;   // AxiosException, CanceledError, AxiosErrorCodes
using AxiosNet.Models;   // AxiosResponse<T>, AxiosHeaders, AxiosFile, AxiosProgressEvent

// Direct requests
AxiosResponse<User> res = await Axios.Get<User>("https://api.test/users/1");
Console.WriteLine($"{res.Status} {res.Data!.Name} in {res.Duration.TotalMilliseconds}ms");

await Axios.Post<User>("https://api.test/users", new { Name = "Ada" });

// Configured instance (axios.create)
AxiosClient api = Axios.Create(new()
{
    BaseUrl = "https://api.test/v1",
    Timeout = TimeSpan.FromSeconds(10),
    Headers = { ["X-App"] = "demo" }
});
api.Defaults.CommonHeaders["Authorization"] = "Bearer token"; // axios defaults.headers.common
api.Defaults.MethodHeaders["post"] = new() { { "X-Post", "1" } }; // axios defaults.headers.post

var list = await api.Get<List<User>>("/users", new() { Params = { ["page"] = 2 } });

API

axios AxiosNet
axios.request(config) Axios.Request<T>(config)
get / delete / head / options Get<T> / Delete<T> / Head<T> / Options<T>(url, config)
post / put / patch Post<T> / Put<T> / Patch<T>(url, data, config)
postForm / putForm / patchForm PostForm<T> / PutForm<T> / PatchForm<T>
axios.getUri(config) Axios.GetUri(config)
axios.create(config) Axios.Create(config, handler)
axios.defaults / instance.defaults Axios.Defaults / client.Defaults
axios.all Axios.All(tasks)
axios.isAxiosError / isCancel Axios.IsAxiosError / IsCancel
axios.mergeConfig Axios.MergeConfig
axios.toFormData Axios.ToFormData
AxiosHeaders AxiosHeaders
CanceledError CanceledError

Config precedence: library defaults, then client defaults, then the request config. Url, Method and Data are never inherited from defaults; headers and params are merged key by key.

Namespaces

The package and assembly are named Axios.Net; the root namespace is AxiosNet so that it does not clash with the static Axios class.

Namespace Types
AxiosNet.Client Axios, AxiosClient
AxiosNet.Config AxiosRequestConfig, AxiosParamsSerializer, AxiosFormSerializer, AxiosTransitional, AxiosProxy, AxiosResponseType
AxiosNet.Errors AxiosException, CanceledError, AxiosErrorCodes
AxiosNet.Models AxiosResponse, AxiosResponse<T>, AxiosHeaders, AxiosFile, AxiosProgressEvent
AxiosNet.Interceptors AxiosInterceptors, InterceptorManager<T>, InterceptorOptions

Request config

Url, Method, BaseUrl, AllowAbsoluteUrls, Headers, MethodHeaders / CommonHeaders, Params, ParamsSerializer (Encode, Serialize, Indexes, MaxDepth), Data, TransformRequest, TransformResponse, Timeout, Auth, ResponseType, ResponseEncoding, ValidateStatus, MaxContentLength, MaxBodyLength, MaxRedirects, Decompress, Proxy, OnUploadProgress, OnDownloadProgress, Redact, Transitional (SilentJsonParsing, ForcedJsonParsing, ClarifyTimeoutError), FormSerializer (Dots, MetaTokens, Indexes, MaxDepth) and CancellationToken (axios' signal).

Bodies and responses

  • Data: string is sent as is (application/x-www-form-urlencoded unless a Content-Type header is set, like axios), byte[] / Stream as binary, HttpContent as is, any other object as JSON. Set Content-Type: application/x-www-form-urlencoded or multipart/form-data (or use PostForm) to serialize an object that way. Use AxiosFile for file parts.
  • T: string, byte[] and Stream return the raw body; anything else is read as JSON (System.Text.Json, web defaults). Override with ResponseType.
  • Query arrays follow axios: a[]=1&a[]=2 by default; use Indexes = null for a=1&a=2 or true for a[0]=1.
  • Responses expose Status, StatusText, Headers (lowercase names), Config, Request, Duration and Data.

Errors

Every failure throws an AxiosException (Code, Config, Request, Response, Status, ToJSON()). Codes are in AxiosErrorCodes: ERR_BAD_REQUEST (4xx), ERR_BAD_RESPONSE, ERR_NETWORK, ERR_CANCELED (CanceledError), ERR_INVALID_URL, ERR_FORM_DATA_DEPTH_EXCEEDED, ECONNABORTED / ETIMEDOUT (timeouts). Use ValidateStatus to resolve selected status codes, and Redact to mask keys in ToJSON().

try { await api.Get<User>("/missing"); }
catch (AxiosException e) { Console.WriteLine($"{e.Code} {e.Status} {e.Response?.Data}"); }

Interceptors

int id = api.Interceptors.Request.Use(
    config => { config.Headers["X-Trace"] = Guid.NewGuid().ToString(); return config; },
    options: new() { RunWhen = c => c.Method == HttpMethod.Get, Synchronous = true });

api.Interceptors.Response.Use(
    response => response,
    error => error is AxiosException { Response: { } r } ? r : throw error); // recover or rethrow

api.Interceptors.Request.Eject(id);
api.Interceptors.Response.Clear();

Request interceptors run last registered first, response interceptors first registered first.

Not applicable in .NET

These axios options are tied to browsers or Node.js and have no equivalent: adapter (pass an HttpMessageHandler to Axios.Create instead), xsrfCookieName, xsrfHeaderName, withXSRFToken, withCredentials, httpAgent, httpsAgent, socketPath, allowedSocketPaths, transport, insecureHTTPParser, formDataHeaderPolicy, env, maxRate, beforeRedirect, sensitiveHeaders, parseReviver (configure AxiosClient.JsonOptions), and the deprecated CancelToken (use CancellationToken). MaxRedirects, Decompress and Proxy need the built-in handler (they are ignored with a custom one).

License

Copyright (C) 2026 Frenchy Apps 42

Axios.Net is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version (AGPL-3.0-or-later).

Axios.Net is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the LICENSE file for the full terms.

In short: you can use, study, change and share it freely. If you distribute a modified version, or let other people use a modified version over a network, you must offer them its source code under the same license.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 48 10/28/2026

Initial release.