Skip to content

Commit

Permalink
chore: formatted curl request for powershell
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpop-zengenti committed Oct 22, 2024
1 parent be4949d commit 0ccd3a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ internal static string CreateCurlCallString(RouteInfo routeInfo, string? host =
curlUri.Host = host;
}

var curlString = $"curl '{curlUri}' \n";
var curlString = $"curl -k '{curlUri}' `\n";
var disallowedHeaders = EndpointRequestService.DisallowedRequestHeaders;
foreach (var header in routeInfo.Headers.Values)
{
Expand All @@ -51,7 +51,7 @@ internal static string CreateCurlCallString(RouteInfo routeInfo, string? host =
}

var headerValue = header.Value.Count() == 1 ? header.Value.First() : string.Join("; ", header.Value);
curlString += $" -H '{header.Key}: {headerValue}' \n";
curlString += $" -H '{header.Key}: {headerValue}' `\n";
}

return curlString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public async Task<EndpointResponse> Invoke(
var curlString = ErrorResources.CreateCurlCallString(routeInfo);

_logger.LogDebug(
"Invoking endpoint {Uri} was successful with status code {StatusCode}. The equivalent curl command is: {CurlString}",
"Invoking endpoint {Uri} was successful with status code {StatusCode}. The equivalent curl command in PowerShell is: {CurlString}",
routeInfo.Uri,
endpointResponse.StatusCode,
curlString);
Expand Down Expand Up @@ -213,7 +213,7 @@ public async Task<EndpointResponse> Invoke(

_logger.Log(
logLevel,
"Invoking endpoint {AbsoluteUri} was not successful: {StatusCode}. The equivalent curl command is: {CurlString}",
"Invoking endpoint {AbsoluteUri} was not successful: {StatusCode}. The equivalent curl command in PowerShell is: {CurlString}",
absoluteUri,
endpointResponse.StatusCode,
curlString);
Expand Down Expand Up @@ -265,7 +265,7 @@ public async Task<EndpointResponse> Invoke(

_logger.LogError(
e,
"Failed to invoke {RouteInfoType} endpoint {Uri} with http method {Method}. The equivalent curl command is: {CurlString}",
"Failed to invoke {RouteInfoType} endpoint {Uri} with http method {Method}. The equivalent curl command in PowerShell is: {CurlString}",
routeInfoType,
routeInfo.Uri,
httpMethod.Method,
Expand Down

0 comments on commit 0ccd3a4

Please sign in to comment.