YamlHttpClient 1.0.5
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Core 3.1
This package targets .NET Core 3.1. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package YamlHttpClient --version 1.0.5
NuGet\Install-Package YamlHttpClient -Version 1.0.5
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="YamlHttpClient" Version="1.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YamlHttpClient --version 1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: YamlHttpClient, 1.0.5"
#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 YamlHttpClient as a Cake Addin #addin nuget:?package=YamlHttpClient&version=1.0.5 // Install YamlHttpClient as a Cake Tool #tool nuget:?package=YamlHttpClient&version=1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
YamlHttpClient
Yaml config based .net HttpClient
Download from NuGet https://www.nuget.org/packages/YamlHttpClient/
How to use
// Sample object
var anyInputObject = new
{
table = new[] { "v1", "v2" },
date = new DateTime(2000, 1, 1),
obj = new[] { new { test = 1 }, new { test = 2 } },
val1 = new Dictionary<string, object>() { { "testkey", "testval" } },
place = "urlPartDemo",
System = new { CodeNT = "internalCode" }
};
// Source config
var file = @"myYamlConfig.yml";
// Core builder, load settings from Yaml source
YamlHttpClientFactory httpClient = new YamlHttpClientFactory(new YamlHttpClientConfigBuilder()
.LoadFromFile(file, "myHttpCall"));
// Here the magic - Build Http message - Dynamically
// from config with your object as data source, see yaml config below
var request = httpClient.BuildRequestMessage(anyInputObject);
// Inspect content if needed
var readContent = await request.Content.ReadAsStringAsync();
// Send it
var response = await httpClient.SendAsync(request);
// Do something with response
var returnData = await response.Content.ReadAsStringAsync();
// Check some stuff from config
await httpClient.CheckResponseAsync(response);
Yaml config sample
http_client:
# Named config key
myHttpCall:
method: POST
url: https://ptsv2.com/t/{{place}}/post
# Ntlm auto negociation
use_default_credentials: true
# Any specific required headers
headers:
CodeNT: '{{System.CodeNT}}'
Accept: 'application/json'
# Example Json content to send, with token template value replacement by Handlebars.net
content:
json_content: |
{
"someVal": "{{val1}}",
"flattenObj": {{{Json . ">flatten;_;_{0}" ">forcestring"}}}
"obj": {{{Json .}}}
}
# Quality assurance if supported by implementation to self check response raw body
check_response:
throw_exception_if_body_contains_any:
- error
throw_exception_if_body_not_contains_all:
- dump
Where VAR is from passed data.
{{{Json VAR}}} # Simple object to json serialization
{{{Json VAR ">flatten;.;[{0}]"}}} # Flatten object to one level dictionary. Child naming childName[0].prop
{{{Json VAR ">flatten;_;_{0}" ">forcestring"}}} # Flatten object to one level dictionary. Child naming childName_0_prop. Force String values.
Features support checklist
- ✅ Support all http methods, POST, GET, DELETE...
- ✅ Send any header
- ✅ Send JSON, string, form data, binary files
- ✅ Basic Http Authentication
- ✅ NTLM (with use default credentials, app pool auto authentication)
- ✅ Check response content and throw exception if response is not expected
- ⬜ NTLM with user/password
- ⬜ Client certificate Authentication
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. 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 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. |
.NET Core | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- Handlebars.Net (>= 2.1.1)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Http (>= 3.1.17)
- Microsoft.Extensions.Options (>= 3.1.17)
- Newtonsoft.Json (>= 13.0.1)
- System.Collections (>= 4.3.0)
- System.Drawing.Common (>= 5.0.3)
- YamlDotNet (>= 11.2.1)
-
net5.0
- Handlebars.Net (>= 2.1.1)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Http (>= 3.1.17)
- Microsoft.Extensions.Options (>= 3.1.17)
- Newtonsoft.Json (>= 13.0.1)
- System.Collections (>= 4.3.0)
- System.Drawing.Common (>= 5.0.3)
- YamlDotNet (>= 11.2.1)
-
net6.0
- Handlebars.Net (>= 2.1.1)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Http (>= 3.1.17)
- Microsoft.Extensions.Options (>= 3.1.17)
- Newtonsoft.Json (>= 13.0.1)
- System.Collections (>= 4.3.0)
- System.Drawing.Common (>= 5.0.3)
- YamlDotNet (>= 11.2.1)
-
net7.0
- Handlebars.Net (>= 2.1.1)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Http (>= 3.1.17)
- Microsoft.Extensions.Options (>= 3.1.17)
- Newtonsoft.Json (>= 13.0.1)
- System.Collections (>= 4.3.0)
- System.Drawing.Common (>= 5.0.3)
- YamlDotNet (>= 11.2.1)
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 |
---|---|---|
1.0.6 | 101 | 9/17/2024 |
1.0.5 | 193 | 9/15/2023 |
1.0.4 | 160 | 9/15/2023 |
1.0.3 | 136 | 9/15/2023 |
1.0.2 | 233 | 3/15/2023 |
1.0.1 | 686 | 3/29/2022 |
1.0.0 | 492 | 1/30/2022 |
1.0.0-rc7 | 214 | 11/9/2021 |
1.0.0-rc6 | 236 | 11/9/2021 |
1.0.0-rc5 | 214 | 11/9/2021 |
1.0.0-rc4 | 183 | 11/8/2021 |
1.0.0-rc3 | 239 | 11/8/2021 |
1.0.0-rc2 | 233 | 11/5/2021 |
1.0.0-rc1 | 219 | 11/5/2021 |
1.0.0-beta4 | 216 | 9/3/2021 |
1.0.0-beta3 | 217 | 8/29/2021 |
1.0.0-beta2 | 222 | 8/28/2021 |
1.0.0-beta1 | 211 | 8/28/2021 |
1.0.0-alpha8 | 216 | 8/26/2021 |
1.0.0-alpha7 | 203 | 8/26/2021 |
1.0.0-alpha6 | 203 | 8/26/2021 |
1.0.0-alpha5 | 225 | 8/25/2021 |
1.0.0-alpha4 | 193 | 8/25/2021 |
1.0.0-alpha3 | 259 | 8/25/2021 |
1.0.0-alpha2 | 255 | 8/25/2021 |
1.0.0-alpha1 | 257 | 8/25/2021 |