Opx.HttpClient
1.0.3
dotnet add package Opx.HttpClient --version 1.0.3
NuGet\Install-Package Opx.HttpClient -Version 1.0.3
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="Opx.HttpClient" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Opx.HttpClient --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Opx.HttpClient, 1.0.3"
#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.
// Install Opx.HttpClient as a Cake Addin #addin nuget:?package=Opx.HttpClient&version=1.0.3 // Install Opx.HttpClient as a Cake Tool #tool nuget:?package=Opx.HttpClient&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Opx.HttpClient
HTTP Client tools, simplify HttpClient.
Usage
Basic
var api = new ApiRequest("https://localhost");
// https://localhost/customers
var customers = await api.RequestJsonAsync<List<Customer>>(HttpMethod.Post, "customers");
Parameter From Query
// https://localhost/customers?Active=true&Sort=name
var customers = await api.RequestJsonAsync<List<Customer>>(HttpMethod.Get, "customers", new ApiRequestParameter()
{
FromQuery = new
{
Active = true,
Sort = "name"
}
);
Parameter From Route
// https://localhost/customers/1
var customer = await api.RequestJsonAsync<Customer>(HttpMethod.Get, "customers/{Id}", new ApiRequestParameter()
{
FromRoute = new
{
Id = 1
}
);
Parameter From Body
// https://localhost/customers/save
var success = await api.RequestJsonAsync<bool>(HttpMethod.Post, "customers/save", new ApiRequestParameter()
{
FromBody = new
{
Id = 1,
FirstName = "John",
LastName = "Doe"
}
);
You can mix those parameters together.
HTTP Request Version
Default RequestVersion
is HTTP/2
var doc = new DocRequest("https://tools.keycdn.com/http2-test", HttpRequestVersion.Http20);
var res = doc.RequestString(HttpMethod.Get);
For HTTP/3 you must set httpVersionPolicy
to HttpVersionPolicy.RequestVersionExact
var doc = new DocRequest("https://cloudflare-quic.com", HttpRequestVersion.Http30, HttpVersionPolicy.RequestVersionExact);
var res = doc.RequestString(HttpMethod.Get);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Opx.HttpClient:
Package | Downloads |
---|---|
Opx.WebApi
Package Description |
|
Opx.LApis
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.