forked from vercel/next.js
/
fetch-event.ts
34 lines (30 loc) · 855 Bytes
/
fetch-event.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { DeprecationError } from '../error'
import { FetchEvent } from '../spec-compliant/fetch-event'
import { NextRequest } from './request'
export class NextFetchEvent extends FetchEvent {
sourcePage: string
constructor(params: { request: NextRequest; page: string }) {
super(params.request)
this.sourcePage = params.page
}
/**
* @deprecated The `request` is now the first parameter and the API is now async.
*
* Read more: https://nextjs.org/docs/messages/middleware-new-signature.
*/
get request() {
throw new DeprecationError({
page: this.sourcePage,
})
}
/**
* @deprecated Using `respondWith` is no longer needed.
*
* Read more: https://nextjs.org/docs/messages/middleware-new-signature.
*/
respondWith() {
throw new DeprecationError({
page: this.sourcePage,
})
}
}