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

Add support for custom undici agents #48

Closed
wants to merge 4 commits into from
Closed

Add support for custom undici agents #48

wants to merge 4 commits into from

Conversation

delvedor
Copy link
Member

@delvedor delvedor commented Apr 12, 2022

This allows using undici's mock utilities.
This library won't work with setGlobalDispatcher because it uses the low-level Pool API.

/cc @mcollina @ronag

Related: elastic/elasticsearch-js#1674

Wait for nodejs/undici#1331 before merging.

@delvedor delvedor added enhancement New feature or request backport 8.2 labels Apr 12, 2022
mcollina
mcollina previously approved these changes Apr 12, 2022
Copy link

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

t.plan(1)

const mockAgent = new MockAgent()
const mockPool = mockAgent.get('http://test-cluster:9200')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might be able to instantiate directly a MockPool

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but you must pass to it an agent, so it's faster to directly create a MockAgent and generate a MockPool from it :)

@delvedor
Copy link
Member Author

delvedor commented May 6, 2022

Superseded by nodejs/undici#1405.

@delvedor delvedor closed this May 6, 2022
@delvedor delvedor deleted the mock-undici branch May 6, 2022 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 8.2 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants