You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[REQ][typescript] Expose Agent option in RequestContext interface #11394
Is your feature request related to a problem? Please describe.
When implementing SSL Auth, passing certificates requires access to the agent option on the fetch(url: RequestInfo, init?: RequestInit): Promise<Response>; call in order to pass ca and cert params.
The RequestContext interface bridges the SecurityAuthentication implementation to the fetch call, and therefore is the optimal choice for passing an optional agent: http.Agent | https.Agent.
Describe the solution you'd like
The addition of an agent: http.Agent | https.Agent | undefined instance variable on the RequestContext class as well as the following methods:
Then, the isomorphic fetch implementation would call getAgent() to pass the value into the agent option on the fetch call in isomorphic-fetch.ts
Describe alternatives you've considered
Another viable option is the allow direct access to the fetch options in the RequestContext, which was the approach in the previous iteration of the typescript generator. This would prevent future one-off additions for other options, but would significantly increase the scope of the PR, and may be unnecessary given the major auth options are already exposed excluding the agent.
This could introduce undesired behavior in which the same option could be potentially passed twice in one call (once in RequestContext instance var and once via fetch options override)
Additional context
This would expand the typescript generator's auth compatibility :)
Activity