fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #1834 from hey-api/chore/platform-localhost-path

chore: support running platform on localhost

authored by

Lubos and committed by
GitHub
54d10835 59ee89a5

+15 -1
+15 -1
packages/openapi-ts/src/createClient.ts
··· 15 15 16 16 const isPlatformPath = (path: string) => 17 17 path.startsWith('https://get.heyapi.dev'); 18 + // || path.startsWith('http://localhost:4000') 18 19 19 20 export const compileInputPath = (input: Config['input']) => { 20 21 const result: Pick< ··· 106 107 107 108 const query = queryParams.join('&'); 108 109 const platformUrl = baseUrl || 'get.heyapi.dev'; 109 - const compiledPath = `https://${[platformUrl, result.organization, result.project].join('/')}`; 110 + const isLocalhost = platformUrl.startsWith('localhost'); 111 + const platformUrlWithProtocol = [ 112 + isLocalhost ? 'http' : 'https', 113 + platformUrl, 114 + ].join('://'); 115 + const compiledPath = isLocalhost 116 + ? [ 117 + platformUrlWithProtocol, 118 + 'v1', 119 + 'get', 120 + result.organization, 121 + result.project, 122 + ].join('/') 123 + : [platformUrlWithProtocol, result.organization, result.project].join('/'); 110 124 result.path = query ? `${compiledPath}?${query}` : compiledPath; 111 125 112 126 return result;