Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"dependencies": {
"@open-draft/until": "^1.0.3",
"@remix-run/web-fetch": "^4.3.1",
"@remix-run/web-fetch": "^4.3.2",
"@types/debug": "^4.1.7",
"debug": "^4.3.3",
"headers-polyfill": "^3.1.0",
Expand Down
5 changes: 2 additions & 3 deletions src/RemoteHttpInterceptor.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { ChildProcess } from 'child_process'
import { Response } from '@remix-run/web-fetch'
import { Request, Response } from '@remix-run/web-fetch'
import { Headers, HeadersObject, headersToObject } from 'headers-polyfill'
import { HttpRequestEventMap } from './glossary'
import { Interceptor } from './Interceptor'
import { BatchInterceptor } from './BatchInterceptor'
import { ClientRequestInterceptor } from './interceptors/ClientRequest'
import { XMLHttpRequestInterceptor } from './interceptors/XMLHttpRequest'
import { toInteractiveRequest } from './utils/toInteractiveRequest'
import { RequestWithCredentials } from './utils/RequestWithCredentials'

export interface SerializedRequest {
id: string
Expand Down Expand Up @@ -159,7 +158,7 @@ export class RemoteHttpResolver extends Interceptor<HttpRequestEventMap> {
) as RevivedRequest
log('parsed intercepted request', requestJson)

const capturedRequest = new RequestWithCredentials(requestJson.url, {
const capturedRequest = new Request(requestJson.url, {
method: requestJson.method,
headers: new Headers(requestJson.headers),
credentials: requestJson.credentials,
Expand Down
5 changes: 2 additions & 3 deletions src/interceptors/ClientRequest/utils/createRequest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Request } from '@remix-run/web-fetch'
import { Request } from '@remix-run/web-fetch'
import { Headers } from 'headers-polyfill'
import { RequestWithCredentials } from '../../../utils/RequestWithCredentials'
import type { NodeClientRequest } from '../NodeClientRequest'

/**
Expand All @@ -23,7 +22,7 @@ export function createRequest(clientRequest: NodeClientRequest): Request {
}
}

return new RequestWithCredentials(clientRequest.url, {
return new Request(clientRequest.url, {
method: clientRequest.method || 'GET',
headers,
credentials: 'same-origin',
Expand Down
4 changes: 2 additions & 2 deletions src/interceptors/XMLHttpRequest/XMLHttpRequestOverride.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
import type { Debugger } from 'debug'
import { until } from '@open-draft/until'
import { Request } from '@remix-run/web-fetch'
import { Headers, stringToHeaders, headersToString } from 'headers-polyfill'
import { parseJson } from '../../utils/parseJson'
import { createEvent } from './utils/createEvent'
Expand All @@ -17,7 +18,6 @@ import { createResponse } from './utils/createResponse'
import { concatArrayBuffer } from './utils/concatArrayBuffer'
import { toInteractiveRequest } from '../../utils/toInteractiveRequest'
import { uuidv4 } from '../../utils/uuid'
import { RequestWithCredentials } from '../../utils/RequestWithCredentials'
import { isDomParserSupportedType } from './utils/isDomParserSupportedType'

type XMLHttpRequestEventHandler = (
Expand Down Expand Up @@ -240,7 +240,7 @@ export const createXMLHttpRequestOverride = (

// Create an intercepted request instance exposed to the request intercepting middleware.
const requestId = uuidv4()
const capturedRequest = new RequestWithCredentials(url, {
const capturedRequest = new Request(url, {
method: this.method,
headers: this._requestHeaders,
credentials: this.withCredentials ? 'include' : 'omit',
Expand Down
27 changes: 0 additions & 27 deletions src/utils/RequestWithCredentials.test.ts

This file was deleted.

24 changes: 0 additions & 24 deletions src/utils/RequestWithCredentials.ts

This file was deleted.

5 changes: 2 additions & 3 deletions test/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import https from 'https'
import http, { ClientRequest, IncomingMessage, RequestOptions } from 'http'
import nodeFetch, { Response, RequestInfo, RequestInit } from 'node-fetch'
import { objectToHeaders } from 'headers-polyfill'
import type { Request } from '@remix-run/web-fetch'
import { Request } from '@remix-run/web-fetch'
import { Page, ScenarioApi } from 'page-with'
import { getRequestOptionsByUrl } from '../src/utils/getRequestOptionsByUrl'
import { getIncomingMessageBody } from '../src/interceptors/ClientRequest/utils/getIncomingMessageBody'
import { SerializedRequest } from '../src/RemoteHttpInterceptor'
import { RequestWithCredentials } from '../src/utils/RequestWithCredentials'

export interface PromisifiedResponse {
req: ClientRequest
Expand Down Expand Up @@ -214,7 +213,7 @@ export async function extractRequestFromPage(page: Page): Promise<Request> {
})
})

const request = new RequestWithCredentials(requestJson.url, {
const request = new Request(requestJson.url, {
method: requestJson.method,
headers: objectToHeaders(requestJson.headers),
credentials: requestJson.credentials,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -916,10 +916,10 @@
"@remix-run/web-stream" "^1.0.0"
web-encoding "1.1.5"

"@remix-run/web-fetch@^4.3.1":
version "4.3.1"
resolved "https://registry.yarnpkg.com/@remix-run/web-fetch/-/web-fetch-4.3.1.tgz#afc88e133bed1a6aecb9d09b1b02127fc844da47"
integrity sha512-TOpuJo3jI7/qJAY0yTnvNJRQl4hlWAOHUHYKAbEddcLFLydv+0/WGT6OaIurJKsBFJJTjooe3FbKiP74sUIB/g==
"@remix-run/web-fetch@^4.3.2":
version "4.3.2"
resolved "https://registry.yarnpkg.com/@remix-run/web-fetch/-/web-fetch-4.3.2.tgz#193758bb7a301535540f0e3a86c743283f81cf56"
integrity sha512-aRNaaa0Fhyegv/GkJ/qsxMhXvyWGjPNgCKrStCvAvV1XXphntZI0nQO/Fl02LIQg3cGL8lDiOXOS1gzqDOlG5w==
dependencies:
"@remix-run/web-blob" "^3.0.4"
"@remix-run/web-form-data" "^3.0.3"
Expand Down