Skip to content

Commit 3a38588

Browse files
committed
chore: added undici import back
1 parent 40ade6d commit 3a38588

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/e2e/next-test-lib/next-test-utils.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import spawn from 'cross-spawn'
33
import { existsSync, readFileSync, unlinkSync, writeFileSync } from 'fs'
44
import { writeFile } from 'fs-extra'
5+
import { fetch as undiciFetch } from 'next/dist/compiled/undici'
56
import nodeFetch from 'node-fetch'
67
import path from 'path'
78
import qs from 'querystring'
@@ -110,7 +111,7 @@ async function processChunkedResponse(response) {
110111
* @param {string | number} appPort
111112
* @param {string} pathname
112113
* @param {Record<string, any> | string | undefined} [query]
113-
* @param {import("undici").RequestInit} [opts]
114+
* @param {import("next/dist/compiled/undici").RequestInit} [opts]
114115
* @returns {Promise<string>}
115116
*/
116117
export function renderViaHTTP(appPort, pathname, query, opts) {
@@ -120,11 +121,11 @@ export function renderViaHTTP(appPort, pathname, query, opts) {
120121
/**
121122
* @param {string | number} appPort
122123
* @param {string} pathname
123-
* @param {Record<string, any> | string | undefined} query
124-
* @param {RequestInit} opts
125-
* @returns {Promise<Response>}
124+
* @param {Record<string, any> | string | null | undefined} [query]
125+
* @param {import('node-fetch').RequestInit} [opts]
126+
* @returns {Promise<Response & {buffer: any} & {headers: Headers}>}
126127
*/
127-
export async function fetchViaHTTP(appPort, pathname, query = undefined, opts = undefined, useUndici = false) {
128+
export function fetchViaHTTP(appPort, pathname, query, opts, useUndici = false) {
128129
const url = `${pathname}${typeof query === 'string' ? query : query ? `?${qs.stringify(query)}` : ''}`
129130
const fetch = useUndici ? undiciFetch : nodeFetch
130131
const fullUrl = getFullUrl(appPort, url)

0 commit comments

Comments
 (0)