|
| 1 | +/** |
| 2 | + * Data extracted from an incoming request to a node server |
| 3 | + */ |
| 4 | +export interface ExtractedNodeRequestData { |
| 5 | + [key: string]: any; |
| 6 | + |
| 7 | + /** Specific headers from the request */ |
| 8 | + headers?: { [key: string]: string }; |
| 9 | + |
| 10 | + /** The request's method */ |
| 11 | + method?: string; |
| 12 | + |
| 13 | + /** The request's URL, including query string */ |
| 14 | + url?: string; |
| 15 | + |
| 16 | + /** String representing the cookies sent along with the request */ |
| 17 | + cookies?: { [key: string]: string }; |
| 18 | + |
| 19 | + /** The request's query string, without the leading '?' */ |
| 20 | + query_string?: string; |
| 21 | + |
| 22 | + /** Any data sent in the request's body, as a JSON string */ |
| 23 | + data?: string; |
| 24 | +} |
| 25 | + |
| 26 | +/** |
| 27 | + * Location object on a service worker's `self` object. |
| 28 | + * |
| 29 | + * See https://developer.mozilla.org/en-US/docs/Web/API/WorkerLocation. |
| 30 | + */ |
| 31 | +export interface WorkerLocation { |
| 32 | + /** The protocol scheme of the URL of the script executed in the Worker, including the final ':'. */ |
| 33 | + readonly protocol: string; |
| 34 | + |
| 35 | + /** The host, that is the hostname, a ':', and the port of the URL of the script executed in the Worker. */ |
| 36 | + readonly host: string; |
| 37 | + |
| 38 | + /** The domain of the URL of the script executed in the Worker. */ |
| 39 | + readonly hostname: string; |
| 40 | + |
| 41 | + /** The canonical form of the origin of the specific location. */ |
| 42 | + readonly origin: string; |
| 43 | + |
| 44 | + /** The port number of the URL of the script executed in the Worker. */ |
| 45 | + readonly port: string; |
| 46 | + |
| 47 | + /** The path of the URL of the script executed in the Worker, beginning with a '/'. */ |
| 48 | + readonly pathname: string; |
| 49 | + |
| 50 | + /** The parameters (query string) of the URL of the script executed in the Worker, beginning with a '?'. */ |
| 51 | + readonly search: string; |
| 52 | + |
| 53 | + /** The fragment identifier of the URL of the script executed in the Worker, beginning with a '#'. */ |
| 54 | + readonly hash: string; |
| 55 | + |
| 56 | + /** Stringifier that returns the whole URL of the script executed in the Worker. */ |
| 57 | + readonly href: string; |
| 58 | + |
| 59 | + /** Synonym for `href` attribute */ |
| 60 | + toString(): string; |
| 61 | +} |
0 commit comments