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(MockHttpSocket): support keepalive (reused) sockets #560

Draft
wants to merge 1 commit into
base: feat/yet-another-socket-interceptor
Choose a base branch
from

Conversation

kettanaito
Copy link
Member

No description provided.

@kettanaito kettanaito changed the base branch from main to feat/yet-another-socket-interceptor April 18, 2024 14:50
private customAgent?: http.RequestOptions['agent']
private onRequest: MockHttpSocketRequestCallback
private onResponse: MockHttpSocketResponseCallback
export function createHttpAgent(options: MockAgentOptions): http.Agent {
Copy link
Member Author

Choose a reason for hiding this comment

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

Mandatory change. Otherwise, we aren't respecting the options.customAgent enough (ignoring its keepalive, max sockets, etc.).

*/
this.responseStream?.push(null)
this.emit('end')
Copy link
Member Author

Choose a reason for hiding this comment

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

I have no idea what to do on the socket so it:

  1. Signals the ClientRequest that the response has ended.
  2. Stays alive.

@kettanaito kettanaito added the help wanted Extra attention is needed label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant