Hi,@Hamed Naeemaei, there's no build-in support for your requirement,you may try with a thrid-party tool,such as HttpClientToCurl
Add this package to your project:
Call GenerateCurlInString,GenerateCurlInConsole,GenerateCurlInFile
method based on your requirement
string requestBody = @"{""name"":""reza"",""referenceCode"":""10001000"",""price"":10000}";
string requestUri = "submit";
var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, requestUri);
httpRequestMessage.Content = new StringContent(requestBody, Encoding.UTF8, "application/json");
httpRequestMessage.Headers.Add("Authorization", $"Bearer {Guid.NewGuid().ToString()}");
using var httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("http://localhost:8080/api/v1");
var curl = httpClient.GenerateCurlInString(httpRequestMessage);
//show the curl in console
httpClient.GenerateCurlInConsole(httpRequestMessage);
Result:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. Best regards, Ruikai Feng