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:
@@ -21,6 +21,9 @@ async function trackApi(method, path, body) {
|
||||
if (!hasTrackAuth) {
|
||||
return { error: 'Track API requires CUSTOMERIO_SITE_ID and CUSTOMERIO_API_KEY environment variables' }
|
||||
}
|
||||
if (args['dry-run']) {
|
||||
return { _dry_run: true, method, url: `${TRACK_URL}${path}`, headers: { Authorization: '***', 'Content-Type': 'application/json' }, body: body || undefined }
|
||||
}
|
||||
const res = await fetch(`${TRACK_URL}${path}`, {
|
||||
method,
|
||||
headers: {
|
||||
@@ -41,6 +44,9 @@ async function appApi(method, path, body) {
|
||||
if (!hasAppAuth) {
|
||||
return { error: 'App API requires CUSTOMERIO_APP_KEY environment variable' }
|
||||
}
|
||||
if (args['dry-run']) {
|
||||
return { _dry_run: true, method, url: `${APP_URL}${path}`, headers: { Authorization: '***', 'Content-Type': 'application/json' }, body: body || undefined }
|
||||
}
|
||||
const res = await fetch(`${APP_URL}${path}`, {
|
||||
method,
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user