Skip to content

Conversation

@kettanaito
Copy link
Member

No description provided.

kettanaito and others added 24 commits March 11, 2024 14:20
@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.).

* @see https://github.com/nodejs/node/blob/29ec7e9331c4944006ffe28e126cc31cc3de271b/lib/_http_client.js#L713
*/
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
Base automatically changed from feat/yet-another-socket-interceptor to main July 4, 2024 18:45
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.

2 participants