mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
chore: use node-fetch-native support for proxy env vars (#3483)
This commit is contained in:
parent
6d751ce675
commit
0c478ad1a0
4 changed files with 3 additions and 134 deletions
|
@ -3,8 +3,7 @@ import {Octokit as OctokitCore} from '@octokit/core'
|
|||
import {paginateRest} from '@octokit/plugin-paginate-rest'
|
||||
import {restEndpointMethods} from '@octokit/plugin-rest-endpoint-methods'
|
||||
import {throttling} from '@octokit/plugin-throttling'
|
||||
import {getProxyForUrl} from 'proxy-from-env'
|
||||
import {createFetch} from 'node-fetch-native/proxy'
|
||||
import {fetch} from 'node-fetch-native/proxy'
|
||||
export {RestEndpointMethodTypes} from '@octokit/plugin-rest-endpoint-methods'
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
export {OctokitOptions} from '@octokit/core/dist-types/types'
|
||||
|
@ -36,9 +35,6 @@ export const throttleOptions = {
|
|||
// Octokit plugin to support the standard environment variables http_proxy, https_proxy and no_proxy
|
||||
function autoProxyAgent(octokit: OctokitCore) {
|
||||
octokit.hook.before('request', options => {
|
||||
const proxy = getProxyForUrl(options.baseUrl)
|
||||
if (proxy) {
|
||||
options.request.fetch = createFetch(proxy)
|
||||
}
|
||||
options.request.fetch = fetch
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue