node-fetch-native icon indicating copy to clipboard operation
node-fetch-native copied to clipboard

Support custom agents with `rejectUnauthorized: false`

Open loks0n opened this issue 1 year ago • 1 comments

Describe the feature

We're building an SDK and we'd like to give users a method that disables SSL verification so they can get things working in their development environment.

It'd be nice to have a simpler version of the createProxy function that just creates an agent, adapting parameters between node-fetch and undici fetch

For example:

import { fetch } from 'node-fetch-native'
import { createAgent } from 'node-fetch-native/agent'

const agent = createAgent({ rejectUnauthorized: false });

fetch('https://localhost:4444/api', { ...agent })

PoC here: https://github.com/loks0n/node-fetch-native/commit/1fe41524d846f481eb96db43b8a3c79b1afa59da

Additional information

  • [X] Would you be willing to help implement this feature?

loks0n avatar Apr 11 '24 10:04 loks0n