diff --git a/playground/proxy-bypass/__tests__/proxy-bypass.spec.ts b/playground/proxy-bypass/__tests__/proxy-bypass.spec.ts
index 093179072a4118..b133f543f2e813 100644
--- a/playground/proxy-bypass/__tests__/proxy-bypass.spec.ts
+++ b/playground/proxy-bypass/__tests__/proxy-bypass.spec.ts
@@ -1,8 +1,19 @@
import { expect, test, vi } from 'vitest'
-import { browserLogs } from '~utils'
+import { browserLogs, page, serverLogs } from '~utils'
test('proxy-bypass', async () => {
await vi.waitFor(() => {
expect(browserLogs.join('\n')).toContain('status of 404 (Not Found)')
})
})
+
+test('async-proxy-bypass', async () => {
+ const content = await page.frame('async-response').content()
+ expect(content).toContain('Hello after 4 ms (async timeout)')
+})
+
+test('async-proxy-bypass-with-error', async () => {
+ await vi.waitFor(() => {
+ expect(serverLogs.join('\n')).toContain('bypass error')
+ })
+})
diff --git a/playground/proxy-bypass/index.html b/playground/proxy-bypass/index.html
index 366aaebb5651ae..e41b3708cfa0e3 100644
--- a/playground/proxy-bypass/index.html
+++ b/playground/proxy-bypass/index.html
@@ -1,2 +1,4 @@
root app
+
+
diff --git a/playground/proxy-bypass/vite.config.js b/playground/proxy-bypass/vite.config.js
index 0873583a5bfa56..8d055a63212e1f 100644
--- a/playground/proxy-bypass/vite.config.js
+++ b/playground/proxy-bypass/vite.config.js
@@ -1,5 +1,7 @@
import { defineConfig } from 'vite'
+const timeout = (ms) => new Promise((r) => setTimeout(r, ms))
+
export default defineConfig({
server: {
port: 9606,
@@ -10,6 +12,22 @@ export default defineConfig({
return false
},
},
+ '/asyncResponse': {
+ bypass: async (_, res) => {
+ await timeout(4)
+ res.writeHead(200, {
+ 'Content-Type': 'text/plain',
+ })
+ res.end('Hello after 4 ms (async timeout)')
+ return '/asyncResponse'
+ },
+ },
+ '/asyncThrowingError': {
+ bypass: async () => {
+ await timeout(4)
+ throw new Error('bypass error')
+ },
+ },
},
},
})