-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
I am trying to use keep-alive agent with node-fetch as described in #423, but I have a problem with HTTPS redirects. Initially, I call a HTTP resource which returns a redirect to a HTTPS resource. In the default node-fetch this is not a problem, because the agent is set based on the current request. When overriding the agent there is no way of having per-request agents.
I would propose an API that allows a function instead of a fixed agent:
fetch(url, { agent: (protocol) => protocol === 'https' ? httpsAgent : httpAgent })Reactions are currently unavailable