Actualiza toolkit operativo y documentación

This commit is contained in:
urieljareth
2026-09-10 20:53:50 -06:00
parent 3b7209dcc1
commit 714057bfc8
69 changed files with 6023 additions and 384 deletions
+6 -2
View File
@@ -29,7 +29,9 @@ $args = @("-sS", "-i", "-X", $Method.ToUpper(), "-H", "Authorization: Bearer $en
if ($PSBoundParameters.ContainsKey("BodyJson")) {
try { $null = $BodyJson | ConvertFrom-Json } catch { throw "BodyJson is not valid JSON: $($_.Exception.Message)" }
$tmpBody = [System.IO.Path]::GetTempFileName()
Set-Content -LiteralPath $tmpBody -Value $BodyJson -NoNewline -Encoding utf8
# Set-Content -Encoding utf8 mete BOM en PS 5.1 y GitHub responde
# 400 "Problems parsing JSON". WriteAllText con UTF8Encoding($false) no lo hace.
[System.IO.File]::WriteAllText($tmpBody, $BodyJson, (New-Object System.Text.UTF8Encoding($false)))
$args += @("--data", "@$tmpBody", "-H", "Content-Type: application/json")
}
@@ -44,7 +46,9 @@ try {
$bodyBlock = if ($parts.Count -ge 2) { $parts[1] } else { "{}" }
$statusLine = ($headersBlock -split "`n" | Select-Object -First 1).Trim()
if ($statusLine -notmatch " 20[04-9] ") {
# 2xx completo: crear un repo responde 201 y la clase anterior ([04-9]) lo
# trataba como error pese al éxito.
if ($statusLine -notmatch " 20[0-9] ") {
$snippet = $bodyBlock.Trim()
if ($snippet.Length -gt 400) { $snippet = $snippet.Substring(0, 400) + "..." }
throw "GitHub API HTTP error: $statusLine`nBody: $snippet"