Skip to content

Commit fc4df5c

Browse files
committed
chore: properly handle base url fallback
1 parent 9c68bcd commit fc4df5c

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

dist/index.js

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/upload.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import path from 'node:path'
55
* Read and upload the provided OpenAPI specification to Hey API.
66
*/
77
export async function upload({
8-
baseUrl = 'https://api.heyapi.dev',
8+
baseUrl,
99
dryRun,
1010
heyApiToken,
1111
pathToOpenApi,
@@ -121,17 +121,16 @@ export async function upload({
121121
formData.append('workflow', process.env.GITHUB_WORKFLOW)
122122
}
123123

124-
console.log(`${baseUrl}/v1/specifications`)
125-
126-
const response = await fetch(`${baseUrl}/v1/specifications`, {
127-
body: formData,
128-
headers: {
129-
Authorization: `Bearer ${heyApiToken}`
130-
},
131-
method: 'POST'
132-
})
133-
134-
console.log(response.status)
124+
const response = await fetch(
125+
`${baseUrl || 'https://api.heyapi.dev'}/v1/specifications`,
126+
{
127+
body: formData,
128+
headers: {
129+
Authorization: `Bearer ${heyApiToken}`
130+
},
131+
method: 'POST'
132+
}
133+
)
135134

136135
if (response.status >= 300) {
137136
const error = await response.json()

0 commit comments

Comments
 (0)