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

make use of global agent #284

Closed
2 tasks done
climba03003 opened this issue Dec 16, 2022 · 0 comments · Fixed by #288
Closed
2 tasks done

make use of global agent #284

climba03003 opened this issue Dec 16, 2022 · 0 comments · Fixed by #288

Comments

@climba03003
Copy link
Member

climba03003 commented Dec 16, 2022

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

It should be a good feature to use the global dispatcher of undici, http, https if someone provide a custom one.
For example, when sharing a global ProxyAgent between this plugin and http client.

Motivation

No response

Example

Since when we use getGlobalDispatcher, undici will create one when not exist.
We need to explicitly opt-in for the global dispatcher to prevent any strange behavior.

I would assume someone need to use it by.

import { setGlobalDispatcher, ProxyAgent } from 'undici'

const proxyAgent = new ProxyAgent('my.proxy.server')
setGlobalDispatcher(proxyAgent)

fastify.register(FastifyReplyFrom, {
  base: 'http://localhost:3001/',
  // http and https is allowed to use http.globalAgent or https.globalAgent
  globalAgent: true, 
  undici: {
  }
})
@climba03003 climba03003 changed the title make use of undici global dispatcher if possible make use of global agent Dec 16, 2022
codrin-ch pushed a commit to codrin-ch/fastify-reply-from that referenced this issue Jan 28, 2023
codrin-ch added a commit to codrin-ch/fastify-reply-from that referenced this issue Jan 28, 2023
codrin-ch added a commit to codrin-ch/fastify-reply-from that referenced this issue Jan 28, 2023
codrin-ch added a commit to codrin-ch/fastify-reply-from that referenced this issue Jan 28, 2023
… introduced breaking change and implement CR
codrin-ch added a commit to codrin-ch/fastify-reply-from that referenced this issue Jan 29, 2023
codrin-ch added a commit to codrin-ch/fastify-reply-from that referenced this issue Jan 29, 2023
@climba03003 climba03003 linked a pull request Jan 29, 2023 that will close this issue
4 tasks
mcollina pushed a commit that referenced this issue Jan 29, 2023
* feat(#284): added option globalAgent to make use of global agent

* feat(#284): update documentation

* feat(#284): update documentation

* feat(#284): update multipart package min required version that introduced breaking change and implement CR

* feat(#284): do not close global agents + coverage, update doc and CR

* feat(#284): fix test

---------

Co-authored-by: Chira Codrin-Mihai <chiracodrin@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant