Skip to content

Restore backward-compatible requestOptions for axios migration#286

Merged
aviadhahami merged 7 commits intomasterfrom
copilot/fix-issue-285
Mar 12, 2026
Merged

Restore backward-compatible requestOptions for axios migration#286
aviadhahami merged 7 commits intomasterfrom
copilot/fix-issue-285

Conversation

Copy link
Contributor

Copilot AI commented Mar 12, 2026

PR #278 replaced postman-request with axios but silently dropped support for TLS options (ca, cert, key, passphrase, agentOptions, strictSSL) passed via requestOptions. The README also documented httpsAgent/httpAgent/timeout forwarding that never actually worked.

Changes

  • src/index.js: Map postman-request-style TLS options to https.Agent in the axios request wrapper. Config-level TLS options are baked into the default agent at init time; per-request agents are only created when per-call options differ (reference comparison). Also forward timeout, httpsAgent, httpAgent to per-request axios options.
  • index.d.ts: Add TlsOptions interface (ca, cert, key, passphrase, pfx, strictSSL, agentOptions, timeout) merged with AxiosRequestConfig for requestOptions type.
  • README.md: Replace stale postman-request reference with accurate description of supported options.
  • example/auth.js: Remove followAllRedirects (silently ignored since axios migration).
  • test/unit.js: 10 new tests covering TLS forwarding, agent caching, and option passthrough.

Usage

// This works again (was silently broken by #278)
const vault = require('node-vault')({
  requestOptions: {
    ca: fs.readFileSync('/path/to/ca.pem'),
  },
});

// Per-call overrides still work
vault.read('secret/data', { ca: otherCaCert });

// Axios-native options also forwarded
const vault2 = require('node-vault')({
  requestOptions: {
    httpsAgent: new SocksProxyAgent('socks://127.0.0.1:1080'),
    timeout: 5000,
  },
});

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI and others added 5 commits March 12, 2026 22:29
Co-authored-by: aviadhahami <7353632+aviadhahami@users.noreply.github.com>
Map postman-request-style TLS options (ca, cert, key, passphrase, pfx,
agentOptions, strictSSL) from requestOptions to an httpsAgent for axios.

Fixes #285

Co-authored-by: aviadhahami <7353632+aviadhahami@users.noreply.github.com>
…n override

Address code review feedback: config.requestOptions TLS settings are now
baked into the default httpsAgent at initialization time. Per-request
agents are only created when per-call TLS options differ from the config
defaults.

Co-authored-by: aviadhahami <7353632+aviadhahami@users.noreply.github.com>
… docs

- Forward timeout, httpsAgent, httpAgent from requestOptions to axios
  per-request options (the README bastion host example now works)
- Update README: replace stale postman-request reference with axios
- Fix example/auth.js: remove silently-ignored followAllRedirects
- Add 3 new tests for timeout, httpsAgent, httpAgent forwarding

Co-authored-by: aviadhahami <7353632+aviadhahami@users.noreply.github.com>
Co-authored-by: aviadhahami <7353632+aviadhahami@users.noreply.github.com>
Copilot AI changed the title [WIP] [NODE-285] Fix issue with retrieving secrets Restore backward-compatible requestOptions for axios migration Mar 12, 2026
Copilot AI requested a review from aviadhahami March 12, 2026 22:43
@aviadhahami aviadhahami marked this pull request as ready for review March 12, 2026 22:51
@aviadhahami aviadhahami merged commit 660cc85 into master Mar 12, 2026
8 checks passed
@aviadhahami aviadhahami deleted the copilot/fix-issue-285 branch March 12, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants