mirror of https://github.com/actions/toolkit
define type for function
parent
daf9b96fc8
commit
8e0ade0a6a
|
@ -1,7 +1,7 @@
|
||||||
import * as http from 'http'
|
import * as http from 'http'
|
||||||
import * as httpClient from '@actions/http-client'
|
import * as httpClient from '@actions/http-client'
|
||||||
import {OctokitOptions} from '@octokit/core/dist-types/types'
|
import {OctokitOptions} from '@octokit/core/dist-types/types'
|
||||||
import {ProxyAgent, fetch as undiciFetch} from 'undici'
|
import {ProxyAgent, fetch} from 'undici'
|
||||||
|
|
||||||
export function getAuthString(
|
export function getAuthString(
|
||||||
token: string,
|
token: string,
|
||||||
|
@ -28,10 +28,10 @@ export function getProxyAgentDispatcher(
|
||||||
return hc.getAgentDispatcher(destinationUrl)
|
return hc.getAgentDispatcher(destinationUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getProxyFetch(destinationUrl): any {
|
export function getProxyFetch(destinationUrl): typeof fetch {
|
||||||
const httpDispatcher = getProxyAgentDispatcher(destinationUrl)
|
const httpDispatcher = getProxyAgentDispatcher(destinationUrl)
|
||||||
const proxyFetch: typeof undiciFetch = (url, opts) => {
|
const proxyFetch = (url, opts) => {
|
||||||
return undiciFetch(url, {
|
return fetch(url, {
|
||||||
...opts,
|
...opts,
|
||||||
dispatcher: httpDispatcher
|
dispatcher: httpDispatcher
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue