Created
May 26, 2025 20:30
-
-
Save langheran/e767fc1c08cea157c93405ea42f8f5c4 to your computer and use it in GitHub Desktop.
C:\Users\NisimHurst\NDS\scripts\cmds\gcurl.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
chcp 437 > nul | |
pushd %~dp0 | |
powershell -command ".\gcurl.ps1 -Uri %*" | |
popd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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