CurlParser.CSharp
1.0.0
Suggested Alternatives
Additional Details
Commits have been migrated to the official repository. Please use the official package: Curl.HttpClient.Converter
dotnet add package CurlParser.CSharp --version 1.0.0
NuGet\Install-Package CurlParser.CSharp -Version 1.0.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="CurlParser.CSharp" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CurlParser.CSharp --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CurlParser.CSharp, 1.0.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.
// Install CurlParser.CSharp as a Cake Addin
#addin nuget:?package=CurlParser.CSharp&version=1.0.0
// Install CurlParser.CSharp as a Cake Tool
#tool nuget:?package=CurlParser.CSharp&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CurlParser.CSharp
A cURL parser and C# code converter based on curl-to-csharp project for .NET Core.
Supported platforms:
- For ASP.NET Core 5, .NET 5
- For ASP.NET Core 3, .NET Core 3.0
Key Features
- Parse cURL command into C# code.
- Convert output from CurlParser into C# code.
- Return parsing errors and warnings if the cURL input is invalid.
Installation
Install with NuGet
dotnet add package CurlParser.CSharp
Usage/Examples
var input = @"curl https://sentry.io/api/0/projects/1/groups/?status=unresolved -d '{""status"": ""resolved""}' -H 'Content-Type: application/json' -u 'username:password' -H 'Accept: application/json' -H 'User-Agent: curl/7.60.0'";
var output = new Converter().Parse(input, 10);
Console.WriteLine(output.Data);
// Output:
/*
// In production code, don't destroy the HttpClient through using, but better reuse an existing instance
// https://www.aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/
using (var httpClient = new HttpClient())
{
using (var request = new HttpRequestMessage(new HttpMethod("POST"), "https://sentry.io/api/0/projects/1/groups/?status=unresolved"))
{
request.Headers.TryAddWithoutValidation("Accept", "application/json");
request.Headers.TryAddWithoutValidation("User-Agent", "curl/7.60.0");
var base64authorization = Convert.ToBase64String(Encoding.ASCII.GetBytes("username:password"));
request.Headers.TryAddWithoutValidation("Authorization", $"Basic {base64authorization}");
request.Content = new StringContent("{\"status\": \"resolved\"}");
request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
var response = await httpClient.SendAsync(request);
}
}
*/
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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. |
.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
- CurlParser (>= 1.0.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.0.1)
-
net5.0
- CurlParser (>= 1.0.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.0.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.0 | 5,571 | 11/24/2021 | |
0.1.203 | 5,261 | 11/23/2021 | |
0.1.170 | 4,697 | 11/24/2021 | |
0.1.170-PullRequest00020002 | 4,634 | 11/24/2021 | |
0.1.169 | 6,008 | 11/24/2021 |