feat: add --dry-run flag to all 47 CLI tools
When --dry-run is passed, each CLI prints the HTTP request it would make (method, URL, headers, body) without actually calling fetch(). Auth credentials are masked as "***" in the output. Useful for verifying request shape and API endpoints without needing real API keys or making actual API calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,15 @@ if (!API_KEY) {
|
||||
}
|
||||
|
||||
async function api(method, path, body, useAccountToken) {
|
||||
if (args['dry-run']) {
|
||||
const maskedHeaders = { 'Content-Type': 'application/json', 'Accept': 'application/json' }
|
||||
if (useAccountToken) {
|
||||
maskedHeaders['X-Postmark-Account-Token'] = '***'
|
||||
} else {
|
||||
maskedHeaders['X-Postmark-Server-Token'] = '***'
|
||||
}
|
||||
return { _dry_run: true, method, url: `${BASE_URL}${path}`, headers: maskedHeaders, body: body || undefined }
|
||||
}
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
|
||||
Reference in New Issue
Block a user