Skip to content

Commit 7a5a9d5

Browse files
author
Crhistian
committed
🐛 fix certs resource using the wrong endpoint url
This is happening because we're expecting all endpoints to have the format of {baseUrl}/{apiVersion}/{path} however endpoints with /oauth/ in the path break this convention and are in the format of simply {baseUrl}/{path} The only affected endpoint is the one endpoint in the certs resource
1 parent 53c6be1 commit 7a5a9d5

4 files changed

Lines changed: 11807 additions & 23 deletions

File tree

codegen/templates/utils/HttpClient.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,23 @@ class HttpClient {
6262
config
6363
) {
6464
const requestConfig = await this._buildRequestConfig(config)
65+
// oauth endpoints unlike the rest don't have /{apiVersion}/ appended to them
66+
const baseApiUrl = path.includes('oauth/')
67+
? `${Configuration.Get().baseApiUrl}/${path}`
68+
: `${Configuration.Get().baseApiUrl}/${
69+
Configuration.Get().apiVersion
70+
}${path}`
6571
if (verb === 'put' || verb === 'post' || verb === 'patch') {
6672
const requestBody = requestConfig.data
6773
delete requestConfig.data
6874
const response = await axios[verb as string](
69-
`${Configuration.Get().baseApiUrl}/${
70-
Configuration.Get().apiVersion
71-
}${path}`,
75+
baseApiUrl,
7276
requestBody,
7377
requestConfig
7478
)
7579
return response.data
7680
} else {
77-
const response = await axios[verb as string](
78-
`${Configuration.Get().baseApiUrl}/${
79-
Configuration.Get().apiVersion
80-
}${path}`,
81-
requestConfig
82-
)
81+
const response = await axios[verb as string](baseApiUrl, requestConfig)
8382
return response.data
8483
}
8584
}

0 commit comments

Comments
 (0)