Handle getContent response as is

Co-authored-by: Henri Maurer <hmaurer@github.com>
This commit is contained in:
cnagadya
2022-11-04 10:08:00 +00:00
parent 3b410dc4ad
commit 97e5a607ba

View File

@@ -168,8 +168,9 @@ async function getRemoteConfig(configFile: string): Promise<string> {
if (data === undefined) {
throw new Error('Invalid content')
}
console.log('Checking data value', data, data === 'fail-on-severity: low\n')
return data as unknown as string
// When using mediaType.format = 'raw', the response.data is a string but this is not reflected
// in the return type of getContent. So we're casting the return value to a string.
return z.string().parse(data as unknown)
} catch (error) {
throw error
}