Skip to content

Instantly share code, notes, and snippets.

@langheran
Created May 26, 2025 20:30
Show Gist options
  • Save langheran/e767fc1c08cea157c93405ea42f8f5c4 to your computer and use it in GitHub Desktop.
Save langheran/e767fc1c08cea157c93405ea42f8f5c4 to your computer and use it in GitHub Desktop.
C:\Users\NisimHurst\NDS\scripts\cmds\gcurl.ps1
@echo off
chcp 437 > nul
pushd %~dp0
powershell -command ".\gcurl.ps1 -Uri %*"
popd
param (
[string]$Uri,
[string]$Method = "GET",
[string]$Body = $null
)
$token = gcloud auth print-access-token
$headers = @{
"Authorization" = "Bearer $token"
"Content-Type" = "application/json"
}
if ($Body) {
Invoke-RestMethod -Uri $Uri -Method $Method -Headers $headers -Body $Body
} else {
Invoke-RestMethod -Uri $Uri -Method $Method -Headers $headers
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment