Streamline management of API collections #1

Merged
administrator merged 43 commits from feature/script-autogenerate-http into main 2026-08-19 14:54:42 +02:00
Showing only changes of commit 4caf0d855e - Show all commits
+15 -6
View File
@@ -113,11 +113,11 @@ function Parse-HttpBlock($text) {
}
return @{
method = $http.method
url = $http.url
params = $http.params
method = $http.method
url = $http.url
params = $http.params
headers = $headers
body = $http.body
body = $http.body
}
}
@@ -238,8 +238,17 @@ function Build-RequestContent($http, $name, $config, $dotenvVars) {
}
if ($http.body) {
$lines += ""
$lines += ($http.body.data | ConvertTo-Json -Depth 10)
if ($http.body.type -eq 'json') {
$lines += ""
try {
$lines += ($http.body.data | ConvertFrom-Json -Depth 10 | ConvertTo-Json -Depth 10)
}
catch {
<#Do this if a terminating exception happens#>
Write-Warning "Failed to parse JSON for request $name, will use original content"
$lines += $http.body.data
}
}
}
return ($lines -join "`n")