@curl-runner/cli 1.7.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curl-runner/cli",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "A powerful CLI tool for HTTP request management using YAML configuration",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",
@@ -101,7 +101,9 @@ export class RequestExecutor {
101
101
  if (attempt > 0) {
102
102
  requestLogger.logRetry(attempt, maxAttempts - 1);
103
103
  if (config.retry?.delay) {
104
- await Bun.sleep(config.retry.delay);
104
+ const backoff = config.retry.backoff ?? 1;
105
+ const delay = config.retry.delay * Math.pow(backoff, attempt - 1);
106
+ await Bun.sleep(delay);
105
107
  }
106
108
  }
107
109
 
@@ -57,6 +57,25 @@ export type FormDataConfig = Record<string, FormFieldValue>;
57
57
  */
58
58
  export type StoreConfig = Record<string, string>;
59
59
 
60
+ /**
61
+ * SSL/TLS certificate configuration options.
62
+ *
63
+ * Examples:
64
+ * - `{ verify: false }` - Disable SSL verification (equivalent to insecure: true)
65
+ * - `{ ca: "./certs/ca.pem" }` - Use custom CA certificate
66
+ * - `{ cert: "./certs/client.pem", key: "./certs/client-key.pem" }` - Mutual TLS (mTLS)
67
+ */
68
+ export interface SSLConfig {
69
+ /** Whether to verify SSL certificates. Defaults to true. */
70
+ verify?: boolean;
71
+ /** Path to CA certificate file for custom certificate authorities. */
72
+ ca?: string;
73
+ /** Path to client certificate file for mutual TLS authentication. */
74
+ cert?: string;
75
+ /** Path to client private key file for mutual TLS authentication. */
76
+ key?: string;
77
+ }
78
+
60
79
  export interface RequestConfig {
61
80
  name?: string;
62
81
  url: string;
@@ -88,10 +107,25 @@ export interface RequestConfig {
88
107
  };
89
108
  proxy?: string;
90
109
  insecure?: boolean;
110
+ /**
111
+ * SSL/TLS certificate configuration.
112
+ * Use this for custom CA certificates or mutual TLS (mTLS) authentication.
113
+ *
114
+ * @example
115
+ * ssl:
116
+ * verify: true
117
+ * ca: "./certs/ca.pem"
118
+ * cert: "./certs/client.pem"
119
+ * key: "./certs/client-key.pem"
120
+ */
121
+ ssl?: SSLConfig;
91
122
  output?: string;
92
123
  retry?: {
93
124
  count: number;
94
125
  delay?: number;
126
+ /** Exponential backoff multiplier. Default is 1 (no backoff).
127
+ * Example: with delay=1000 and backoff=2, delays are: 1000ms, 2000ms, 4000ms, 8000ms... */
128
+ backoff?: number;
95
129
  };
96
130
  variables?: Record<string, string>;
97
131
  /**
@@ -171,6 +205,11 @@ export interface GlobalConfig {
171
205
  * Controls when curl-runner should exit with non-zero status codes.
172
206
  */
173
207
  ci?: CIExitConfig;
208
+ /**
209
+ * Global SSL/TLS certificate configuration.
210
+ * Applied to all requests unless overridden at the request level.
211
+ */
212
+ ssl?: SSLConfig;
174
213
  variables?: Record<string, string>;
175
214
  output?: {
176
215
  verbose?: boolean;
@@ -91,10 +91,26 @@ export class CurlBuilder {
91
91
  parts.push('-x', config.proxy);
92
92
  }
93
93
 
94
- if (config.insecure) {
94
+ // SSL/TLS configuration
95
+ // insecure: true takes precedence (backwards compatibility)
96
+ // ssl.verify: false is equivalent to insecure: true
97
+ if (config.insecure || config.ssl?.verify === false) {
95
98
  parts.push('-k');
96
99
  }
97
100
 
101
+ // SSL certificate options
102
+ if (config.ssl) {
103
+ if (config.ssl.ca) {
104
+ parts.push('--cacert', `"${config.ssl.ca}"`);
105
+ }
106
+ if (config.ssl.cert) {
107
+ parts.push('--cert', `"${config.ssl.cert}"`);
108
+ }
109
+ if (config.ssl.key) {
110
+ parts.push('--key', `"${config.ssl.key}"`);
111
+ }
112
+ }
113
+
98
114
  if (config.output) {
99
115
  parts.push('-o', config.output);
100
116
  }