CurlParser.CSharp 0.1.170

There is a newer version of this package available.
See the version list below for details.
dotnet add package CurlParser.CSharp --version 0.1.170
NuGet\Install-Package CurlParser.CSharp -Version 0.1.170
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="0.1.170" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CurlParser.CSharp --version 0.1.170
#r "nuget: CurlParser.CSharp, 0.1.170"
#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=0.1.170

// Install CurlParser.CSharp as a Cake Tool
#tool nuget:?package=CurlParser.CSharp&version=0.1.170

CurlParser.CSharp

Build status Quality Gate Docker pulls

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 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.

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,567 11/24/2021
0.1.203 5,260 11/23/2021
0.1.170 4,697 11/24/2021
0.1.170-PullRequest00020002 4,633 11/24/2021
0.1.169 6,008 11/24/2021