diff --git a/packages/request-manager/src/interceptor/overloadHttpRequest.ts b/packages/request-manager/src/interceptor/overloadHttpRequest.ts index ef66e1420aa..60cfbc9a545 100644 --- a/packages/request-manager/src/interceptor/overloadHttpRequest.ts +++ b/packages/request-manager/src/interceptor/overloadHttpRequest.ts @@ -12,16 +12,16 @@ const getIdentityName = (proxyAuthorization?: http.OutgoingHttpHeader) => { }; /** Should the request be blocked if Tor isn't enabled? */ -export const getIsTorRequired = (options: Readonly) => - !!options.headers?.['Proxy-Authorization']; +export const getIsTorRequired = (options?: Readonly) => + !!options?.headers?.['Proxy-Authorization']; -const getIdentityForAgent = (options: Readonly) => { - if (options.headers?.['Proxy-Authorization']) { +const getIdentityForAgent = (options?: Readonly) => { + if (options?.headers?.['Proxy-Authorization']) { // Use Proxy-Authorization header to define proxy identity // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization return getIdentityName(options.headers['Proxy-Authorization']); } - if (options.headers?.Upgrade === 'websocket') { + if (options?.headers?.Upgrade === 'websocket') { // Create random identity for each websocket connection return `WebSocket/${options.host}/${getWeakRandomId(16)}`; }