本文整理汇总了TypeScript中builder-util/out/nodeHttpExecutor.httpExecutor.request方法的典型用法代码示例。如果您正苦于以下问题:TypeScript httpExecutor.request方法的具体用法?TypeScript httpExecutor.request怎么用?TypeScript httpExecutor.request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类builder-util/out/nodeHttpExecutor.httpExecutor
的用法示例。
在下文中一共展示了httpExecutor.request方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: computeElectronVersion
export async function computeElectronVersion(projectDir: string, projectMetadata: MetadataValue): Promise<string> {
const result = await getElectronVersionFromInstalled(projectDir)
if (result != null) {
return result
}
const electronPrebuiltDep = findFromElectronPrebuilt(await projectMetadata!!.value)
if (electronPrebuiltDep == null || electronPrebuiltDep === "latest") {
try {
const releaseInfo = JSON.parse((await httpExecutor.request({
hostname: "github.com",
path: "/electron/electron/releases/latest",
headers: {
Accept: "application/json",
},
}))!!)
return (releaseInfo.tag_name.startsWith("v")) ? releaseInfo.tag_name.substring(1) : releaseInfo.tag_name
}
catch (e) {
warn(e)
}
throw new Error(`Cannot find electron dependency to get electron version in the '${path.join(projectDir, "package.json")}'`)
}
const firstChar = electronPrebuiltDep[0]
return firstChar === "^" || firstChar === "~" ? electronPrebuiltDep.substring(1) : electronPrebuiltDep
}