( input, options = {} )
| 11 | } |
| 12 | |
| 13 | function toRequestConfig ( input, options = {} ) { |
| 14 | if ( typeof input === 'string' || input instanceof URL ) { |
| 15 | return { |
| 16 | ...options, |
| 17 | url: normalizeUrl( input ) |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | if ( input && typeof input === 'object' && 'url' in input ) { |
| 22 | return { |
| 23 | ...input, |
| 24 | ...options, |
| 25 | url: normalizeUrl( input.url ) |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | throw new Error( 'Expected a request URL or config object with a url field.' ) |
| 30 | } |
| 31 | |
| 32 | function createHeaders ( inputHeaders = {} ) { |
| 33 | return new Headers( inputHeaders ) |
no test coverage detected