Skip to content

GetStarted

mozhganEtaati edited this page Oct 9, 2025 · 6 revisions

🚀 Get Started

It’s easy to use HttpClientToCurl!
You just need to install the package in your .NET project and use the sample codes below to see how to call and work with the extensions.


📦 Installation

To add the package to your project from NuGet, use the following command:

dotnet add package HttpClientToCurl

Or visit the NuGet page here: HttpClientToCurl


⚡ Quick Start

you can see quick samples of get curl from HttpClient or HttpRequestMessage in .Net below:

🌀 HttpClient Extension

You have 3 Quick ways to see the generated curl script result from HttpClient:

1️⃣ Put it in a string variable

string curlScript = httpClientInstance.GenerateCurlInString(httpRequestMessage);

2️⃣ Show it in the IDE console

httpClientInstance.GenerateCurlInConsole(httpRequestMessage);

Notice: when the curl script was written in the console, maybe your IDE console applies WordWrap automatically. you should remove enters from the script.

Notice: You can set specific configurations for your result in the optional second parameter.

3️⃣ Write it into a file

httpClientInstance.GenerateCurlInFile(httpRequestMessage);

Notice: You can set specific configurations for your result using the optional second parameter.

🌀HttpRequestMessage Extension

You have 3 Quick ways to see the generated curl script result from HttpRequestMessage:

1️⃣ Put it in a string variable

string curlResult = httpRequestMessage.GenerateCurlInString(new Uri("http://localhost:1213/v1/"));

2️⃣ Show it in the IDE console

httpRequestMessage.GenerateCurlInConsole(new Uri("http://localhost:1213/v1/"));

Notice: when the curl script was written in the console, maybe your IDE console applies WordWrap automatically. you should remove enters from the script.

Notice: You can set specific configurations for your result in the optional second parameter.

3️⃣ Write it into a file

httpRequestMessage.GenerateCurlInFile(new Uri("http://localhost:1213/v1/"));

Notice: You can set specific configurations for your result using the optional second parameter.

Clone this wiki locally