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

fix(ClientRequest): support addRequest from custom http agents #666

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kettanaito
Copy link
Member

@kettanaito
Copy link
Member Author

I think the test failures are related to some HTTP requests being bypassed when they shouldn't be. Perhaps the super.addRequest() actually schedules the request to be performed. I need to look into that and make sure that's only called for passthrough requests if that's the case.

@kettanaito kettanaito changed the title fix: support addRequest from custom http agents fix(ClientRequest): support addRequest from custom http agents Oct 30, 2024
@kettanaito kettanaito marked this pull request as draft October 30, 2024 17:49
@kettanaito
Copy link
Member Author

kettanaito commented Oct 30, 2024

Issue

The flow is this:

  1. addRequest
  2. createSocket
  3. createConnection

If we call this.customAgent.addRequest(), it will likely tap into super.addRequest() of the http.Agent it extends, triggering the actual connection.

I'm trying to patch the http.Agent class so that any custom agents that extend it don't instantiate actual requests by tapping into super. Instead, the actual request will be instantiated in the MockHttpAgent in individual request's context.

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

Successfully merging this pull request may close these issues.

1 participant