diff --git a/src/Axios.Net.Extensions.DependencyInjection/NamespaceDoc.cs b/src/Axios.Net.Extensions.DependencyInjection/NamespaceDoc.cs
new file mode 100644
index 0000000..af9038f
--- /dev/null
+++ b/src/Axios.Net.Extensions.DependencyInjection/NamespaceDoc.cs
@@ -0,0 +1,4 @@
+namespace AxiosNet.Extensions.DependencyInjection;
+
+/// Registration of in a dependency injection container.
+internal static class NamespaceDoc;
diff --git a/src/Axios.Net.Extensions.DependencyInjection/ServiceCollectionExtensions.cs b/src/Axios.Net.Extensions.DependencyInjection/ServiceCollectionExtensions.cs
index 94897af..610e5b1 100644
--- a/src/Axios.Net.Extensions.DependencyInjection/ServiceCollectionExtensions.cs
+++ b/src/Axios.Net.Extensions.DependencyInjection/ServiceCollectionExtensions.cs
@@ -4,8 +4,23 @@
namespace AxiosNet.Extensions.DependencyInjection;
+/// Dependency injection extensions for .
public static class ServiceCollectionExtensions
{
+ ///
+ /// Registers as a singleton. Its requests go through the Axios.Net named
+ /// client, so handlers can be chained with
+ /// AddHttpClient("Axios.Net").AddHttpMessageHandler<T>().
+ ///
+ ///
+ /// The handler comes from the factory, so ,
+ /// and are no longer read
+ /// from the request config: configure them on the primary handler. The singleton keeps the handler it was
+ /// created with, so it is not recycled and DNS changes are not picked up.
+ ///
+ /// The service collection to add the client to.
+ /// Sets the defaults merged into every request of the client.
+ /// The same service collection, for chaining.
public static IServiceCollection AddAxios(this IServiceCollection services, Action? configure = null)
{
services.AddHttpClient("Axios.Net");
diff --git a/src/Axios.Net/Client/Axios.cs b/src/Axios.Net/Client/Axios.cs
index 6977a30..e8aa43f 100644
--- a/src/Axios.Net/Client/Axios.cs
+++ b/src/Axios.Net/Client/Axios.cs
@@ -21,46 +21,97 @@ public static class Axios
typeof(Axios).Assembly.GetCustomAttribute()?.InformationalVersion
.Split('+')[0] ?? "0.0.0";
+ /// Defaults applied to every request sent through the shared client.
public static AxiosRequestConfig Defaults => Instance.Defaults;
+ /// Interceptors of the shared client.
public static AxiosInterceptors Interceptors => Instance.Interceptors;
/// Creates an isolated client with its own defaults and interceptors.
public static AxiosClient Create(AxiosRequestConfig? config = null, HttpMessageHandler? handler = null) =>
new(config, handler);
+ /// Sends a request fully described by .
+ /// Type the response body is read as.
+ /// The request, merged over the defaults.
public static Task> Request(AxiosRequestConfig config) =>
Instance.Request(config);
+ /// Sends a GET request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Config merged over the defaults for this request.
public static Task> Get(string url, AxiosRequestConfig? config = null) =>
Instance.Get(url, config);
+ /// Sends a DELETE request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Config merged over the defaults for this request.
public static Task> Delete(string url, AxiosRequestConfig? config = null) =>
Instance.Delete(url, config);
+ /// Sends a HEAD request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Config merged over the defaults for this request.
public static Task> Head(string url, AxiosRequestConfig? config = null) =>
Instance.Head(url, config);
+ /// Sends an OPTIONS request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Config merged over the defaults for this request.
public static Task> Options(string url, AxiosRequestConfig? config = null) =>
Instance.Options(url, config);
+ /// Sends a POST request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Request body, serialized according to its type.
+ /// Config merged over the defaults for this request.
public static Task> Post(string url, object? data = null, AxiosRequestConfig? config = null) =>
Instance.Post(url, data, config);
+ /// Sends a PUT request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Request body, serialized according to its type.
+ /// Config merged over the defaults for this request.
public static Task> Put(string url, object? data = null, AxiosRequestConfig? config = null) =>
Instance.Put(url, data, config);
+ /// Sends a PATCH request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Request body, serialized according to its type.
+ /// Config merged over the defaults for this request.
public static Task> Patch(string url, object? data = null, AxiosRequestConfig? config = null) =>
Instance.Patch(url, data, config);
+ /// Sends a POST request with Content-Type: multipart/form-data.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Request body, serialized according to its type.
+ /// Config merged over the defaults for this request.
public static Task>
PostForm(string url, object? data = null, AxiosRequestConfig? config = null) =>
Instance.PostForm(url, data, config);
+ /// Sends a PUT request with Content-Type: multipart/form-data.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Request body, serialized according to its type.
+ /// Config merged over the defaults for this request.
public static Task>
PutForm(string url, object? data = null, AxiosRequestConfig? config = null) =>
Instance.PutForm(url, data, config);
+ /// Sends a PATCH request with Content-Type: multipart/form-data.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Request body, serialized according to its type.
+ /// Config merged over the defaults for this request.
public static Task> PatchForm(string url, object? data = null,
AxiosRequestConfig? config = null) =>
Instance.PatchForm(url, data, config);
diff --git a/src/Axios.Net/Client/AxiosClient.cs b/src/Axios.Net/Client/AxiosClient.cs
index 0111800..a6ef922 100644
--- a/src/Axios.Net/Client/AxiosClient.cs
+++ b/src/Axios.Net/Client/AxiosClient.cs
@@ -14,6 +14,10 @@
namespace AxiosNet.Client;
+///
+/// HTTP client with its own defaults and interceptors, the equivalent of an axios instance.
+/// Created with .
+///
public class AxiosClient
{
private readonly HttpClient _http;
@@ -23,8 +27,10 @@ public class AxiosClient
/// Defaults applied to every request of this client.
public AxiosRequestConfig Defaults { get; }
+ /// Request and response interceptors of this client.
public AxiosInterceptors Interceptors { get; } = new();
+ /// Options used to serialize JSON bodies and to deserialize JSON responses.
public JsonSerializerOptions JsonOptions { get; set; } = new(JsonSerializerDefaults.Web);
/// Defaults merged into every request.
@@ -44,24 +50,55 @@ public AxiosClient(AxiosRequestConfig? defaults = null, HttpMessageHandler? hand
#region Request aliases
+ /// Sends a GET request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Config merged over the defaults for this request.
public Task> Get(string url, AxiosRequestConfig? config = null) =>
Send(HttpMethod.Get, url, null, config);
+ /// Sends a DELETE request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Config merged over the defaults for this request.
public Task> Delete(string url, AxiosRequestConfig? config = null) =>
Send(HttpMethod.Delete, url, null, config);
+ /// Sends a HEAD request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Config merged over the defaults for this request.
public Task> Head(string url, AxiosRequestConfig? config = null) =>
Send(HttpMethod.Head, url, null, config);
+ /// Sends an OPTIONS request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Config merged over the defaults for this request.
public Task> Options(string url, AxiosRequestConfig? config = null) =>
Send(HttpMethod.Options, url, null, config);
+ /// Sends a POST request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Request body, serialized according to its type.
+ /// Config merged over the defaults for this request.
public Task> Post(string url, object? data = null, AxiosRequestConfig? config = null) =>
Send(HttpMethod.Post, url, data, config);
+ /// Sends a PUT request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Request body, serialized according to its type.
+ /// Config merged over the defaults for this request.
public Task> Put(string url, object? data = null, AxiosRequestConfig? config = null) =>
Send(HttpMethod.Put, url, data, config);
+ /// Sends a PATCH request.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Request body, serialized according to its type.
+ /// Config merged over the defaults for this request.
public Task> Patch(string url, object? data = null, AxiosRequestConfig? config = null) =>
Send(HttpMethod.Patch, url, data, config);
@@ -69,9 +106,19 @@ public Task> Patch(string url, object? data = null, AxiosReq
public Task> PostForm(string url, object? data = null, AxiosRequestConfig? config = null) =>
Send(HttpMethod.Post, url, data, AsForm(config));
+ /// Sends a PUT request with Content-Type: multipart/form-data.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Request body, serialized according to its type.
+ /// Config merged over the defaults for this request.
public Task> PutForm(string url, object? data = null, AxiosRequestConfig? config = null) =>
Send(HttpMethod.Put, url, data, AsForm(config));
+ /// Sends a PATCH request with Content-Type: multipart/form-data.
+ /// Type the response body is read as.
+ /// Absolute URL, or relative to .
+ /// Request body, serialized according to its type.
+ /// Config merged over the defaults for this request.
public Task> PatchForm(string url, object? data = null, AxiosRequestConfig? config = null) =>
Send(HttpMethod.Patch, url, data, AsForm(config));
diff --git a/src/Axios.Net/Client/NamespaceDoc.cs b/src/Axios.Net/Client/NamespaceDoc.cs
new file mode 100644
index 0000000..24b477c
--- /dev/null
+++ b/src/Axios.Net/Client/NamespaceDoc.cs
@@ -0,0 +1,4 @@
+namespace AxiosNet.Client;
+
+/// The shared client and the instances created from it.
+internal static class NamespaceDoc;
diff --git a/src/Axios.Net/Config/AxiosFormSerializer.cs b/src/Axios.Net/Config/AxiosFormSerializer.cs
index 21b5de3..03dd4da 100644
--- a/src/Axios.Net/Config/AxiosFormSerializer.cs
+++ b/src/Axios.Net/Config/AxiosFormSerializer.cs
@@ -12,5 +12,6 @@ public class AxiosFormSerializer
/// Array format, same meaning as .
public bool? Indexes { get; set; } = false;
+ /// Maximum nesting depth of an object body; going deeper fails with .
public int MaxDepth { get; set; } = 100;
}
diff --git a/src/Axios.Net/Config/AxiosProxy.cs b/src/Axios.Net/Config/AxiosProxy.cs
index 127724d..1ac0c89 100644
--- a/src/Axios.Net/Config/AxiosProxy.cs
+++ b/src/Axios.Net/Config/AxiosProxy.cs
@@ -2,17 +2,22 @@
namespace AxiosNet.Config;
+/// Proxy settings of a request.
public class AxiosProxy
{
/// Pass as to ignore system and environment proxies.
public static readonly AxiosProxy Disabled = new();
+ /// Proxy scheme, such as http.
public string Protocol { get; set; } = "http";
+ /// Proxy host name or address.
public string Host { get; set; } = string.Empty;
+ /// Proxy port.
public int Port { get; set; }
+ /// User name and password sent to the proxy, when it requires them.
public (string Username, string Password)? Auth { get; set; }
internal WebProxy ToWebProxy() => new($"{Protocol}://{Host}:{Port}")
diff --git a/src/Axios.Net/Config/AxiosRequestConfig.cs b/src/Axios.Net/Config/AxiosRequestConfig.cs
index 0bad73b..c428c90 100644
--- a/src/Axios.Net/Config/AxiosRequestConfig.cs
+++ b/src/Axios.Net/Config/AxiosRequestConfig.cs
@@ -40,6 +40,7 @@ public class AxiosRequestConfig
///
public Dictionary Params { get; set; } = [];
+ /// Controls how are turned into a query string.
public AxiosParamsSerializer? ParamsSerializer { get; set; }
///
@@ -92,15 +93,19 @@ public class AxiosRequestConfig
///
public AxiosProxy? Proxy { get; set; }
+ /// Called as the request body is sent.
public Action? OnUploadProgress { get; set; }
+ /// Called as the response body is received.
public Action? OnDownloadProgress { get; set; }
/// Config keys masked (case-insensitive, recursive) by .
public List? Redact { get; set; }
+ /// Behaviors kept for compatibility with older axios versions.
public AxiosTransitional? Transitional { get; set; }
+ /// Controls how object bodies are serialized as multipart/form-data or application/x-www-form-urlencoded.
public AxiosFormSerializer? FormSerializer { get; set; }
/// Cancels the request (axios' signal).
diff --git a/src/Axios.Net/Config/AxiosResponseType.cs b/src/Axios.Net/Config/AxiosResponseType.cs
index d84d912..1427f6a 100644
--- a/src/Axios.Net/Config/AxiosResponseType.cs
+++ b/src/Axios.Net/Config/AxiosResponseType.cs
@@ -1,9 +1,11 @@
namespace AxiosNet.Config;
+/// How the response body is read.
public enum AxiosResponseType
{
/// Body is deserialized from JSON into T.
Json,
+ /// Body is returned as a string.
Text,
/// Body is returned as byte[].
diff --git a/src/Axios.Net/Config/AxiosTransitional.cs b/src/Axios.Net/Config/AxiosTransitional.cs
index 1a790ed..cbaa9aa 100644
--- a/src/Axios.Net/Config/AxiosTransitional.cs
+++ b/src/Axios.Net/Config/AxiosTransitional.cs
@@ -1,5 +1,6 @@
namespace AxiosNet.Config;
+/// Behaviors kept for compatibility with older axios versions.
public class AxiosTransitional
{
/// Request configuration, with its serializers, proxy and response type.
+internal static class NamespaceDoc;
diff --git a/src/Axios.Net/Errors/AxiosErrorCodes.cs b/src/Axios.Net/Errors/AxiosErrorCodes.cs
index 0bbf301..1259db0 100644
--- a/src/Axios.Net/Errors/AxiosErrorCodes.cs
+++ b/src/Axios.Net/Errors/AxiosErrorCodes.cs
@@ -3,13 +3,28 @@ namespace AxiosNet.Errors;
/// Values of , same identifiers as axios.
public static class AxiosErrorCodes
{
+ /// A config option is not valid.
public const string BadOption = "ERR_BAD_OPTION";
+
+ /// A config option has an invalid value.
public const string BadOptionValue = "ERR_BAD_OPTION_VALUE";
+
+ /// The server answered with a 4xx status that was rejected.
public const string BadRequest = "ERR_BAD_REQUEST";
+
+ /// The status was rejected, a size limit was exceeded or the body could not be read.
public const string BadResponse = "ERR_BAD_RESPONSE";
+
+ /// The request could not reach the server.
public const string Network = "ERR_NETWORK";
+
+ /// The request was canceled.
public const string Canceled = "ERR_CANCELED";
+
+ /// The URL is invalid or not absolute.
public const string InvalidUrl = "ERR_INVALID_URL";
+
+ /// Params or a form object are nested too deeply.
public const string FormDataDepthExceeded = "ERR_FORM_DATA_DEPTH_EXCEEDED";
/// Request timed out (default).
diff --git a/src/Axios.Net/Errors/AxiosException.cs b/src/Axios.Net/Errors/AxiosException.cs
index b2eaa79..c1d73c7 100644
--- a/src/Axios.Net/Errors/AxiosException.cs
+++ b/src/Axios.Net/Errors/AxiosException.cs
@@ -14,6 +14,7 @@ public class AxiosException : Exception
/// One of .
public string Code { get; }
+ /// The config the request was sent with.
public AxiosRequestConfig Config { get; }
/// The request that was sent, when it got that far.
@@ -24,10 +25,19 @@ public class AxiosException : Exception
///
public AxiosResponse? Response { get; }
+ /// HTTP status of , when the server answered.
public int? Status => Response?.Status;
+ /// Always true, like the isAxiosError flag of axios errors.
public bool IsAxiosError => true;
+ /// Creates the error of a failed request.
+ /// Description of the failure.
+ /// One of .
+ /// The config the request was sent with.
+ /// The request that was sent, when it got that far.
+ /// The response, when the server answered.
+ /// The exception that caused this one.
public AxiosException(
string message,
string code,
diff --git a/src/Axios.Net/Errors/CanceledError.cs b/src/Axios.Net/Errors/CanceledError.cs
index 36da5c9..76c6d05 100644
--- a/src/Axios.Net/Errors/CanceledError.cs
+++ b/src/Axios.Net/Errors/CanceledError.cs
@@ -5,6 +5,11 @@ namespace AxiosNet.Errors;
/// Thrown when a request is canceled through .
public class CanceledError : AxiosException
{
+ /// Creates the error of a canceled request.
+ /// The config the request was sent with.
+ /// Description of the cancellation.
+ /// The request that was sent, when it got that far.
+ /// The exception that caused this one.
public CanceledError(
AxiosRequestConfig config,
string message = "canceled",
diff --git a/src/Axios.Net/Errors/NamespaceDoc.cs b/src/Axios.Net/Errors/NamespaceDoc.cs
new file mode 100644
index 0000000..0e940bd
--- /dev/null
+++ b/src/Axios.Net/Errors/NamespaceDoc.cs
@@ -0,0 +1,4 @@
+namespace AxiosNet.Errors;
+
+/// The thrown by failed requests, its variant and the .
+internal static class NamespaceDoc;
diff --git a/src/Axios.Net/Interceptors/AxiosInterceptors.cs b/src/Axios.Net/Interceptors/AxiosInterceptors.cs
index 20102e4..8de7b37 100644
--- a/src/Axios.Net/Interceptors/AxiosInterceptors.cs
+++ b/src/Axios.Net/Interceptors/AxiosInterceptors.cs
@@ -3,6 +3,7 @@
namespace AxiosNet.Interceptors;
+/// The request and response interceptor chains of a client.
public sealed class AxiosInterceptors
{
/// Runs before sending, last registered first (LIFO). Return the (modified) config.
diff --git a/src/Axios.Net/Interceptors/InterceptorManager.cs b/src/Axios.Net/Interceptors/InterceptorManager.cs
index 74a903f..3b0cc50 100644
--- a/src/Axios.Net/Interceptors/InterceptorManager.cs
+++ b/src/Axios.Net/Interceptors/InterceptorManager.cs
@@ -1,5 +1,9 @@
namespace AxiosNet.Interceptors;
+///
+/// An ordered chain of interceptors: register one with Use, remove it with Eject or Clear.
+///
+/// What the chain transforms: the request config or the response.
public sealed class InterceptorManager
{
private readonly List> _handlers = [];
diff --git a/src/Axios.Net/Interceptors/InterceptorOptions.cs b/src/Axios.Net/Interceptors/InterceptorOptions.cs
index 3717ebd..5ea2e53 100644
--- a/src/Axios.Net/Interceptors/InterceptorOptions.cs
+++ b/src/Axios.Net/Interceptors/InterceptorOptions.cs
@@ -2,6 +2,7 @@
namespace AxiosNet.Interceptors;
+/// Options of a single interceptor.
public sealed class InterceptorOptions
{
///
diff --git a/src/Axios.Net/Interceptors/NamespaceDoc.cs b/src/Axios.Net/Interceptors/NamespaceDoc.cs
new file mode 100644
index 0000000..32e6cf3
--- /dev/null
+++ b/src/Axios.Net/Interceptors/NamespaceDoc.cs
@@ -0,0 +1,4 @@
+namespace AxiosNet.Interceptors;
+
+/// Request and response interceptors, and their options.
+internal static class NamespaceDoc;
diff --git a/src/Axios.Net/Models/AxiosFile.cs b/src/Axios.Net/Models/AxiosFile.cs
index a9a9b44..fad2248 100644
--- a/src/Axios.Net/Models/AxiosFile.cs
+++ b/src/Axios.Net/Models/AxiosFile.cs
@@ -3,15 +3,26 @@ namespace AxiosNet.Models;
/// A file part for multipart bodies.
public sealed class AxiosFile
{
+ /// The file content, a byte[] or a .
public object Content { get; }
+ /// File name sent with the multipart part.
public string FileName { get; }
+ /// Media type of the part, when set.
public string? ContentType { get; }
+ /// Creates a file part from bytes.
+ /// The file content.
+ /// File name sent with the part.
+ /// Media type of the part.
public AxiosFile(byte[] content, string fileName, string? contentType = null)
=> (Content, FileName, ContentType) = (content, fileName, contentType);
+ /// Creates a file part from a stream.
+ /// The file content, read when the request is sent.
+ /// File name sent with the part.
+ /// Media type of the part.
public AxiosFile(Stream content, string fileName, string? contentType = null)
=> (Content, FileName, ContentType) = (content, fileName, contentType);
}
diff --git a/src/Axios.Net/Models/AxiosHeaders.cs b/src/Axios.Net/Models/AxiosHeaders.cs
index f652812..f5c0240 100644
--- a/src/Axios.Net/Models/AxiosHeaders.cs
+++ b/src/Axios.Net/Models/AxiosHeaders.cs
@@ -7,10 +7,13 @@ public class AxiosHeaders : IEnumerable>
{
private readonly Dictionary _headers = new(StringComparer.OrdinalIgnoreCase);
+ /// Creates an empty collection.
public AxiosHeaders()
{
}
+ /// Creates a collection holding a copy of .
+ /// The headers to copy.
public AxiosHeaders(IEnumerable> source)
{
foreach ((string name, string value) in source)
@@ -19,6 +22,7 @@ public AxiosHeaders(IEnumerable> source)
}
}
+ /// Number of headers.
public int Count => _headers.Count;
/// Gets a header (null when absent). Assigning null removes it.
@@ -38,6 +42,9 @@ public string? this[string name]
}
}
+ /// Sets a header, replacing any previous value.
+ /// Header name, case-insensitive.
+ /// Header value.
public AxiosHeaders Set(string name, string value)
{
_headers[name] = value;
@@ -45,6 +52,8 @@ public AxiosHeaders Set(string name, string value)
return this;
}
+ /// Sets several headers, replacing any previous values.
+ /// The headers to set.
public AxiosHeaders Set(IEnumerable> headers)
{
foreach ((string name, string value) in headers)
@@ -58,12 +67,16 @@ public AxiosHeaders Set(IEnumerable> headers)
/// Enables collection initializers: new AxiosHeaders { { "Accept", "text/plain" } }.
public void Add(string name, string value) => Set(name, value);
+ /// Gets a header value, or null when absent.
public string? Get(string name) => _headers.GetValueOrDefault(name);
+ /// True when the header is present.
public bool Has(string name) => _headers.ContainsKey(name);
+ /// Removes a header and returns whether it was present.
public bool Delete(string name) => _headers.Remove(name);
+ /// Removes every header.
public AxiosHeaders Clear()
{
_headers.Clear();
@@ -84,6 +97,7 @@ public AxiosHeaders Concat(params AxiosHeaders[] others)
return result;
}
+ /// Returns a copy of this collection.
public AxiosHeaders Clone() => new(_headers);
/// Parses raw "Name: value" lines.
@@ -109,9 +123,11 @@ public static AxiosHeaders Parse(string raw)
/// Plain dictionary copy, convenient for serialization.
public Dictionary ToJson() => new(_headers, StringComparer.OrdinalIgnoreCase);
+ /// Raw Name: value lines, one per header.
public override string ToString()
=> string.Concat(_headers.Select(h => $"{h.Key}: {h.Value}\n"));
+ /// Enumerates the headers.
public IEnumerator> GetEnumerator() => _headers.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
diff --git a/src/Axios.Net/Models/AxiosProgressEvent.cs b/src/Axios.Net/Models/AxiosProgressEvent.cs
index 2a0af60..9e269b1 100644
--- a/src/Axios.Net/Models/AxiosProgressEvent.cs
+++ b/src/Axios.Net/Models/AxiosProgressEvent.cs
@@ -1,9 +1,12 @@
namespace AxiosNet.Models;
+/// Progress of a request body upload or of a response download.
public sealed class AxiosProgressEvent
{
+ /// Bytes transferred so far.
public long Loaded { get; init; }
+ /// Total number of bytes, when known.
public long? Total { get; init; }
/// Fraction between 0 and 1, when the total is known.
@@ -15,9 +18,12 @@ public sealed class AxiosProgressEvent
/// Bytes per second since the previous event.
public double? Rate { get; init; }
+ /// Estimated time remaining, when the rate and the total are known.
public TimeSpan? Estimated { get; init; }
+ /// True for an upload event.
public bool Upload { get; init; }
+ /// True for a download event.
public bool Download => !Upload;
}
diff --git a/src/Axios.Net/Models/AxiosResponse.cs b/src/Axios.Net/Models/AxiosResponse.cs
index 8b48311..dbf4546 100644
--- a/src/Axios.Net/Models/AxiosResponse.cs
+++ b/src/Axios.Net/Models/AxiosResponse.cs
@@ -2,10 +2,13 @@
namespace AxiosNet.Models;
+/// The response to a request, with an untyped body.
public class AxiosResponse
{
+ /// HTTP status code.
public int Status { get; init; }
+ /// Reason phrase sent by the server.
public string? StatusText { get; init; }
/// Response and content headers.
diff --git a/src/Axios.Net/Models/AxiosResponseT.cs b/src/Axios.Net/Models/AxiosResponseT.cs
index 1d51b9a..4a6365d 100644
--- a/src/Axios.Net/Models/AxiosResponseT.cs
+++ b/src/Axios.Net/Models/AxiosResponseT.cs
@@ -1,5 +1,7 @@
namespace AxiosNet.Models;
+/// A response whose body is converted to .
+/// Type of the body.
public class AxiosResponse : AxiosResponse
{
/// Body converted to (default when empty).
diff --git a/src/Axios.Net/Models/NamespaceDoc.cs b/src/Axios.Net/Models/NamespaceDoc.cs
new file mode 100644
index 0000000..3212808
--- /dev/null
+++ b/src/Axios.Net/Models/NamespaceDoc.cs
@@ -0,0 +1,4 @@
+namespace AxiosNet.Models;
+
+/// Responses, headers, files and progress events.
+internal static class NamespaceDoc;
diff --git a/src/Axios.Net/Serialization/AxiosSerializer.cs b/src/Axios.Net/Serialization/AxiosSerializer.cs
index 69c25d5..d811381 100644
--- a/src/Axios.Net/Serialization/AxiosSerializer.cs
+++ b/src/Axios.Net/Serialization/AxiosSerializer.cs
@@ -28,7 +28,6 @@ public static string DefaultEncode(string value) => Uri.EscapeDataString(value)
public static string BuildUrl(AxiosRequestConfig config)
{
string url = config.Url ?? string.Empty;
-
bool absolute = AbsoluteUrl().IsMatch(url);
if (