Spaces:
Paused
Paused
File size: 571 Bytes
9ada4bc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import { RequestController } from './RequestController'
export type InteractiveRequest = globalThis.Request & {
respondWith: RequestController['respondWith']
}
export function toInteractiveRequest(request: Request): {
interactiveRequest: InteractiveRequest
requestController: RequestController
} {
const requestController = new RequestController(request)
Reflect.set(
request,
'respondWith',
requestController.respondWith.bind(requestController)
)
return {
interactiveRequest: request as InteractiveRequest,
requestController,
}
}
|