Files
Janka UrygaandGitHub 82e84e430b feat(after): stabilize unstable_after (#73605)
- rename `unstable_after` -> `after`
- remove `experimental.after` flag (and warn if it's present)

i separated the big find-and-replace into a separate commit so that it's
easier to see what else changed apart from that.

does not touch docs, that's in #73038
2024-12-06 19:59:57 +00:00

65 lines
1.4 KiB
JavaScript

import { cookies, headers } from 'next/headers'
import { after, connection } from 'next/server'
export function testRequestAPIs(/** @type {string} */ route) {
after(async () => {
try {
await headers()
console.log(`[${route}] headers(): ok`)
} catch (err) {
console.error(`[${route}] headers(): error:`, err)
}
})
after(() =>
after(async () => {
try {
await headers()
console.log(`[${route}] nested headers(): ok`)
} catch (err) {
console.error(`[${route}] nested headers(): error:`, err)
}
})
)
after(async () => {
try {
await cookies()
console.log(`[${route}] cookies(): ok`)
} catch (err) {
console.error(`[${route}] cookies(): error:`, err)
}
})
after(() =>
after(async () => {
try {
await cookies()
console.log(`[${route}] nested cookies(): ok`)
} catch (err) {
console.error(`[${route}] nested cookies(): error:`, err)
}
})
)
after(async () => {
try {
await connection()
console.log(`[${route}] connection(): ok`)
} catch (err) {
console.error(`[${route}] connection(): error:`, err)
}
})
after(() =>
after(async () => {
try {
await connection()
console.log(`[${route}] nested connection(): ok`)
} catch (err) {
console.error(`[${route}] nested connection(): error:`, err)
}
})
)
}