Adrià Vilanova MartÃnez | 9c418ab | 2024-12-05 15:34:40 +0100 | [diff] [blame^] | 1 | export default class FetchInput { |
2 | constructor(private input: RequestInfo | URL) {} | ||||
3 | |||||
4 | /** | ||||
5 | * Returns the fetch input URL as a string. | ||||
6 | */ | ||||
7 | getUrl() { | ||||
8 | if (typeof this.input === 'string') { | ||||
9 | return this.input; | ||||
10 | } else if (this.input instanceof URL) { | ||||
11 | return this.input.toString(); | ||||
12 | } else { | ||||
13 | return this.input.url; | ||||
14 | } | ||||
15 | } | ||||
16 | } |