MCPcopy
hub / github.com/vercel/next.js / checkRes

Function checkRes

test/integration/file-serving/test/index.test.ts:22–36  ·  view source on GitHub ↗
(res)

Source from the content-addressed store, hash-verified

20 const containRegex = /(This page could not be found|Bad Request)/
21 // test base mount point `public/`
22 const checkRes = async (res) => {
23 if (res.status === 308) {
24 const redirectDest = res.headers.get('location')
25 const parsedUrl = new URL(redirectDest)
26 expect(parsedUrl.hostname).toBeOneOf(['localhost', '127.0.0.1'])
27 } else {
28 try {
29 expect(res.status === 400 || res.status === 404).toBe(true)
30 } catch (err) {
31 require('console').error({ path, status: res.status })
32 throw err
33 }
34 expect(await res.text()).toMatch(containRegex)
35 }
36 }
37 const res = await fetchViaHTTP(appPort, path, undefined, {
38 redirect: 'manual',
39 })

Callers 1

expectStatusFunction · 0.85

Calls 5

getMethod · 0.65
errorMethod · 0.65
textMethod · 0.65
expectFunction · 0.50
requireFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…