Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public availability = async (app: string, hintIndex: number) => {
const stickyHint =
hintIndex === undefined || hintIndex === null
? `request:${this.context.account}:${this.context.workspace}:${app}`
: `request:${this.context.account}:${this.context.workspace}:${app}:${hintIndex}`
const headers = {
'Content-Type': 'application/json',
'x-vtex-sticky-host': stickyHint,
}
const metric = 'bh-availability'
const {
data: { availability },
headers: { 'x-vtex-sticky-host': host },
} = await this.http.getRaw(routes.availability(app), { headers, metric, cacheable: CacheType.None })
const { hostname, score } = availability as AvailabilityResponse
return { host, hostname, score }
}