Skip to content

Commit cd17bcb

Browse files
Add 'Global Registration' and 'Specific Registration'
1 parent 8786cbf commit cd17bcb

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,43 @@ For full examples, detailed usage, and advanced configuration options, please se
3636
👉 [Open Wiki → More Details](https://github.com/amingolmahalle/HttpClientToCurlGenerator/wiki)
3737

3838
## 🚀 **Usage Example**
39+
40+
### ⚡ Quick Usage
41+
42+
#### 1️⃣ Global Registration
43+
44+
Enable cURL generation globally so that every `HttpClient` created through `IHttpClientFactory` automatically logs cURL commands before sending requests.
45+
46+
**Program.cs / Startup:**
47+
48+
```csharp
49+
using HttpClientToCurl;
50+
51+
// Register global cURL generation mode
52+
builder.Services.AddHttpClientToCurlInGeneralMode(builder.Configuration);
53+
54+
// Register a default HttpClient (now cURL-enabled)
55+
builder.Services.AddHttpClient();
56+
```
57+
58+
#### 2️⃣ Specific Registration
59+
60+
If you only want cURL generation for specific clients, you can enable it per-client easily using the built-in registration helpers.
61+
62+
**Program.cs / Startup:**
63+
64+
```csharp
65+
using HttpClientToCurl;
66+
67+
// Register the cURL generator service once
68+
builder.Services.AddHttpClientToCurl(builder.Configuration);
69+
70+
// Then register specific HttpClients with cURL logging enabled
71+
builder.Services.AddHttpClient("my-client1", showCurl: true);
72+
```
73+
74+
### ⚙️ Manual Usage
75+
3976
```csharp
4077
using System.Text;
4178
using HttpClientToCurl;

0 commit comments

Comments
 (0)