File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { pruneGetRequestBody } from './pruneGetRequestBody'
2+ import type { IncomingWorkerRequest } from './workerChannel'
23
34/**
45 * Converts a given request received from the Service Worker
56 * into a Fetch `Request` instance.
67 */
78export function deserializeRequest (
8- serializedRequest : ServiceWorkerIncomingRequest ,
9+ serializedRequest : IncomingWorkerRequest ,
910) : Request {
1011 return new Request ( serializedRequest . url , {
1112 ...serializedRequest ,
Original file line number Diff line number Diff line change 1- import type { ServiceWorkerIncomingRequest } from '../glossary '
1+ import type { IncomingWorkerRequest } from './workerChannel '
22
3- type Input = Pick < ServiceWorkerIncomingRequest , 'method' | 'body' >
3+ type Input = Pick < IncomingWorkerRequest , 'method' | 'body' >
44
55/**
66 * Ensures that an empty GET request body is always represented as `undefined`.
77 */
88export function pruneGetRequestBody (
99 request : Input ,
10- ) : ServiceWorkerIncomingRequest [ 'body' ] {
10+ ) : IncomingWorkerRequest [ 'body' ] | undefined {
1111 // Force HEAD/GET request body to always be empty.
1212 // The worker reads any request's body as ArrayBuffer,
1313 // and you cannot re-construct a GET/HEAD Request
You can’t perform that action at this time.
0 commit comments