Skip to content

Commit

Permalink
chore: clean up ClientRequest utils (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito authored Apr 18, 2024
1 parent 430c65e commit fc73636
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 388 deletions.
8 changes: 4 additions & 4 deletions src/interceptors/ClientRequest/MockHttpSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Readable } from 'node:stream'
import { invariant } from 'outvariant'
import { INTERNAL_REQUEST_ID_HEADER_NAME } from '../../Interceptor'
import { MockSocket } from '../Socket/MockSocket'
import type { NormalizedWriteArgs } from '../Socket/utils/normalizeWriteArgs'
import type { NormalizedSocketWriteArgs } from '../Socket/utils/normalizeSocketWriteArgs'
import { isPropertyAccessible } from '../../utils/isPropertyAccessible'
import { baseUrlFromConnectionOptions } from '../Socket/utils/baseUrlFromConnectionOptions'
import { parseRawHeaders } from '../Socket/utils/parseRawHeaders'
Expand Down Expand Up @@ -53,7 +53,7 @@ export class MockHttpSocket extends MockSocket {
private onRequest: MockHttpSocketRequestCallback
private onResponse: MockHttpSocketResponseCallback

private writeBuffer: Array<NormalizedWriteArgs> = []
private writeBuffer: Array<NormalizedSocketWriteArgs> = []
private request?: Request
private requestParser: HTTPParser<0>
private requestStream?: Readable
Expand Down Expand Up @@ -133,7 +133,7 @@ export class MockHttpSocket extends MockSocket {
// the original socket instance (i.e. write request body).
// Exhaust the "requestBuffer" in case this Socket
// gets reused for different requests.
let writeArgs: NormalizedWriteArgs | undefined
let writeArgs: NormalizedSocketWriteArgs | undefined
let headersWritten = false

while ((writeArgs = this.writeBuffer.shift())) {
Expand Down Expand Up @@ -373,7 +373,7 @@ export class MockHttpSocket extends MockSocket {
}

private flushWriteBuffer(): void {
let args: NormalizedWriteArgs | undefined
let args: NormalizedSocketWriteArgs | undefined
while ((args = this.writeBuffer.shift())) {
args?.[2]?.()
}
Expand Down
26 changes: 0 additions & 26 deletions src/interceptors/ClientRequest/utils/cloneIncomingMessage.test.ts

This file was deleted.

74 changes: 0 additions & 74 deletions src/interceptors/ClientRequest/utils/cloneIncomingMessage.ts

This file was deleted.

53 changes: 0 additions & 53 deletions src/interceptors/ClientRequest/utils/createResponse.test.ts

This file was deleted.

55 changes: 0 additions & 55 deletions src/interceptors/ClientRequest/utils/createResponse.ts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit fc73636

Please sign in to comment.