MCPcopy
hub / github.com/ThatGuySam/doesitarm / toRequestConfig

Function toRequestConfig

helpers/http.js:13–30  ·  view source on GitHub ↗
( input, options = {} )

Source from the content-addressed store, hash-verified

11}
12
13function 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
32function createHeaders ( inputHeaders = {} ) {
33 return new Headers( inputHeaders )

Callers 1

requestFunction · 0.85

Calls 1

normalizeUrlFunction · 0.85

Tested by

no test coverage detected