Skip to content

Commit

Permalink
Use proxy if environment exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
halton committed May 3, 2018
1 parent 163dcb3 commit 3eb4e9a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ async function runPing(url: string): Promise<number> {
const start = Date.now()

if (process.env.NODE_ENV !== 'test') {
await fetch(url)
if (process.env.http_proxy) {
await fetch(url, { agent:new HttpsProxyAgent(process.env.http_proxy)})
} else {
await fetch(url)
}
}

return Date.now() - start
Expand Down

0 comments on commit 3eb4e9a

Please sign in to comment.