@@ -108,12 +108,19 @@ export function getRegistryProxy(
108108 * Constructs a `RequestRequestOptions` with a custom `fetch` implementation
109109 * that uses `dispatcher` as a proxy for requests.
110110 *
111- * @param dispatcher The proxy to use.
111+ * @param dispatcher The proxy to use, if any .
112112 */
113113export function makeProxyRequestOptions (
114- dispatcher : ProxyAgent ,
115- ) : RequestRequestOptions {
114+ dispatcher : ProxyAgent | undefined ,
115+ ) : RequestRequestOptions | undefined {
116+ // If we don't have a custom `ProxyAgent`, return the defaults.
117+ if ( dispatcher === undefined ) {
118+ return githubUtils . defaults . request ;
119+ }
120+
121+ // Otherwise, construct the custom `fetch` and add it onto the defaults.
116122 return {
123+ ...githubUtils . defaults . request ,
117124 fetch : ( req : RequestInfo , init ?: RequestInit ) => {
118125 return undiciFetch ( req , { ...init , dispatcher } ) ;
119126 } ,
@@ -136,10 +143,7 @@ function createApiClientWithDetails(
136143 const auth =
137144 ( allowExternal && apiDetails . externalRepoAuth ) || apiDetails . auth ;
138145 const retryingOctokit = githubUtils . GitHub . plugin ( retry . retry ) ;
139- const requestOptions =
140- proxy === undefined
141- ? githubUtils . defaults . request
142- : makeProxyRequestOptions ( proxy ) ;
146+ const requestOptions = makeProxyRequestOptions ( proxy ) ;
143147 return new retryingOctokit (
144148 githubUtils . getOctokitOptions ( auth , {
145149 baseUrl : apiDetails . apiURL ,
0 commit comments