Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client certificate support? #87

Closed
1 task
ottob opened this issue Jul 31, 2023 · 1 comment
Closed
1 task

Client certificate support? #87

ottob opened this issue Jul 31, 2023 · 1 comment

Comments

@ottob
Copy link

ottob commented Jul 31, 2023

Describe the feature

This was possible in node-fetch using a https.Agent:

 const agent = new https.Agent({
   cert,
   key,
   keepAlive: true,
   timeout: 3 * 1000,
})
const response = await fetch(url, {
    agent,
    method: 'post',
    ...

Is there any way of doing this with this library?

see also: nodejs/node#48977 and nodejs/node#47592

Additional information

  • Would you be willing to help implement this feature?
@pi0
Copy link
Member

pi0 commented Aug 22, 2023

Hi. Surely you can pass agent as an option. Types are missing because there is no spec for it but you can. See this example in nuxt (ofetch uses node-fetch-native under the scenes)

https://github.com/nuxt/nuxt/blob/7b35a1fe4faed49fffe3427a0db4aabae138f4ae/packages/vite/src/runtime/vite-node-shared.mjs#L11

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

No branches or pull requests

2 participants