Opx.HttpClient
1.1.0
dotnet add package Opx.HttpClient --version 1.1.0
NuGet\Install-Package Opx.HttpClient -Version 1.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="Opx.HttpClient" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Opx.HttpClient" Version="1.1.0" />
<PackageReference Include="Opx.HttpClient" />
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 Opx.HttpClient --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Opx.HttpClient, 1.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 Opx.HttpClient@1.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=Opx.HttpClient&version=1.1.0
#tool nuget:?package=Opx.HttpClient&version=1.1.0
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 | net9.0 is compatible. 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.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Opx.HttpClient:
| Package | Downloads |
|---|---|
|
Opx.LApis
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.