@curl-runner/cli 1.8.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 +1 -1
- package/src/types/config.ts +36 -0
- package/src/utils/curl-builder.ts +17 -1
package/package.json
CHANGED
package/src/types/config.ts
CHANGED
|
@@ -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,6 +107,18 @@ 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;
|
|
@@ -174,6 +205,11 @@ export interface GlobalConfig {
|
|
|
174
205
|
* Controls when curl-runner should exit with non-zero status codes.
|
|
175
206
|
*/
|
|
176
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;
|
|
177
213
|
variables?: Record<string, string>;
|
|
178
214
|
output?: {
|
|
179
215
|
verbose?: boolean;
|
|
@@ -91,10 +91,26 @@ export class CurlBuilder {
|
|
|
91
91
|
parts.push('-x', config.proxy);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
|
|
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
|
}
|