Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2025-06-02 17:50:04 +00:00
parent 55ff016766
commit 313daefcef
1570 changed files with 4230 additions and 228668 deletions

View file

@ -181,6 +181,20 @@ export class MockHttpSocket extends MockSocket {
const socket = this.createConnection()
this.originalSocket = socket
/**
* @note Inherit the original socket's connection handle.
* Without this, each push to the mock socket results in a
* new "connection" listener being added (i.e. buffering pushes).
* @see https://github.com/nodejs/node/blob/b18153598b25485ce4f54d0c5cb830a9457691ee/lib/net.js#L734
*/
if ('_handle' in socket) {
Object.defineProperty(this, '_handle', {
value: socket._handle,
enumerable: true,
writable: true,
})
}
// If the developer destroys the socket, destroy the original connection.
this.once('error', (error) => {
socket.destroy(error)

View file

@ -25,12 +25,37 @@ export class ClientRequestInterceptor extends Interceptor<HttpRequestEventMap> {
}
protected setup(): void {
const { get: originalGet, request: originalRequest } = http
const {
ClientRequest: OriginalClientRequest,
get: originalGet,
request: originalRequest,
} = http
const { get: originalHttpsGet, request: originalHttpsRequest } = https
const onRequest = this.onRequest.bind(this)
const onResponse = this.onResponse.bind(this)
// Support requests performed via the `ClientRequest` constructor directly.
http.ClientRequest = new Proxy(http.ClientRequest, {
construct: (target, args: Parameters<typeof http.request>) => {
const [url, options, callback] = normalizeClientRequestArgs(
'http:',
args
)
// Create a mock agent instance appropriate for the request protocol.
const Agent = options.protocol === 'https:' ? MockHttpsAgent : MockAgent
const mockAgent = new Agent({
customAgent: options.agent,
onRequest,
onResponse,
})
options.agent = mockAgent
return Reflect.construct(target, [url, options, callback])
},
})
http.request = new Proxy(http.request, {
apply: (target, thisArg, args: Parameters<typeof http.request>) => {
const [url, options, callback] = normalizeClientRequestArgs(
@ -112,6 +137,8 @@ export class ClientRequestInterceptor extends Interceptor<HttpRequestEventMap> {
recordRawFetchHeaders()
this.subscriptions.push(() => {
http.ClientRequest = OriginalClientRequest
http.get = originalGet
http.request = originalRequest

View file

@ -90,8 +90,9 @@ export class FetchResponse extends Response {
const finalBody = FetchResponse.isResponseWithBody(status) ? body : null
super(finalBody, {
...init,
status: safeStatus,
statusText: init.statusText,
headers: init.headers,
})
if (status !== safeStatus) {