EasyHttpsClient 2.0.0
dotnet add package EasyHttpsClient --version 2.0.0
NuGet\Install-Package EasyHttpsClient -Version 2.0.0
<PackageReference Include="EasyHttpsClient" Version="2.0.0" />
<PackageVersion Include="EasyHttpsClient" Version="2.0.0" />
<PackageReference Include="EasyHttpsClient" />
paket add EasyHttpsClient --version 2.0.0
#r "nuget: EasyHttpsClient, 2.0.0"
#:package EasyHttpsClient@2.0.0
#addin nuget:?package=EasyHttpsClient&version=2.0.0
#tool nuget:?package=EasyHttpsClient&version=2.0.0
EasyHttpsClient
v2.0.0
EasyHttpsClient is a simple and easy-to-use HTTP client library for .NET, .NET Core and .NET Framework
It provides an easier syntax for sending GET, POST, PUT, DELETE requests and retrieving response data.
Work In Progress:
Different endpoint requires various requests.
Feel Free to submit issues or pull requests on GitHub aurel192 - EasyHttpsClient repository
Links
GitHub aurel192 - EasyHttpsClient repository
NuGet Package - EasyHttpsClient
Usage
Setting / Adding - Headers, Timeout, Encoding, and more...
client.AddToRequestHeaders("Authorization", "Bearer token / ApiKey / etc ...");
client.SetTimeout(10);
client.SetEncoding(Encoding.UTF8);
GET:
var getClient = new HttpGetClient();
getClient.SetUrl($"{BaseUrl}/api/TestItems/");
// It will just send the request
await getClient.SendAsync();
// This line will read the result as string
string responseString = await getClient.ReadResultAsStringAsync();
// or byte array
byte[] responseByteArray = await getClient.ReadResultAsByteArrayAsync();
Console.WriteLine(response);
// You can access the raw HttpResponseMessage if you need it for some reason
HttpResponseMessage httpResponseMessage = getClient.GetHttpResponseMessage();
POST:
var postClient = new HttpPostClient();
postClient.SetTimeout(10);
postClient.SetEncoding(Encoding.UTF8);
// POST FormUrlEncodedContent
postClient.SetUrl("https://www.example.com/api/PostKeyValuePairsHere/");
postClient.AddBodyPostData("key1", "value1");
postClient.AddBodyPostData("key2", "value2");
// POST StringContent
var payloadObject = new
{
key = "NEW ITEM KEY",
value = "NEW NEW",
value2 = "BRAND NEW TEST ITEM",
boolean = true,
};
// Note: it can be any serializable object
postClient.SetBodyRequestData(payloadObject);
// Or as Json string
// Note: it can be any format (e.g. XML, ...) depending on the endpoint
string payloadJson = @"{""key"": ""NEW ITEM KEY"",""value"": ""NEW NEW"",""value2"": ""BRAND NEW TEST ITEM"",""boolean"": true}";
postClient.SetBodyRequestJson(payloadJson);
await postClient.SendAsync();
string responseString = await postClient.ReadResultAsStringAsync();
PUT
var putClient = new HttpPutClient();
putClient.SetUrl($"{BaseUrl}/api/TestItems/1");
var modifiedObject = new
{
key = "THIS IS NOT THE ORIGINAL",
value = "IT WILL MODIFY",
value2 = "MODIFY THE FIRST ELEMENT",
boolean = true,
};
putClient.SetBodyRequestData(payloadObject);
await putClient.SendAsync();
string responseString = await putClient.ReadResultAsStringAsync();
DELETE
var deleteClient = new HttpDeleteClient();
deleteClient.SetUrl($"{BaseUrl}/api/TestItems/15");
await deleteClient.SendAsync();
string responseString = await deleteClient.ReadResultAsStringAsync();
License
This library is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome.
Submit issues or pull requests on GitHub aurel192 - EasyHttpsClient repository
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Net.Http (>= 4.2.0)
- System.Text.Json (>= 9.0.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.