Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private githubRequest(path: string, token: string | null, data: {[name: string]: any; } | null = null, method?: "GET" | "DELETE" | "PUT"): Promise {
// host can contains port, but node http doesn't support host as url does
const baseUrl = parseUrl(`https://${this.info.host || "api.github.com"}`)
return parseJson(httpExecutor.request(configureRequestOptions({
hostname: baseUrl.hostname,
port: baseUrl.port as any,
path: (this.info.host != null && this.info.host !== "github.com") ? `/api/v3${path.startsWith("/") ? path : `/${path}`}` : path,
headers: {accept: "application/vnd.github.v3+json"}
}, token, method), this.context.cancellationToken, data))
}