Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
stream.on("response", headers => {
const status: number = headers[HTTP2_HEADER_STATUS] as any
if (status !== HTTP_STATUS_OK) {
reject(new HttpError(status))
return
}
stream.pipe(StreamValues.withParser())
.on("data", (object: any) => {
const data = object.value
if (log.isDebugEnabled) {
log.debug({event: JSON.stringify(data, null, 2)}, "remote builder event")
}
if (data.status != null) {
log.info({status: data.status}, "remote building")
}
else if ("error" in data) {
resolve({files: null, error: data.error})
}
export function checkStatus(status: number, reject: (error: Error) => void) {
if (status === HTTP_STATUS_OK) {
return true
}
else {
reject(new HttpError(status))
return false
}
}