-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { | ||
Agent, | ||
Dispatcher, | ||
} from 'undici'; | ||
import { AsyncLocalStorage } from 'node:async_hooks'; | ||
import { FetchOpaque } from './FetchOpaqueInterceptor.js'; | ||
|
||
export interface BaseAgentOptions extends Agent.Options { | ||
opaqueLocalStorage: AsyncLocalStorage<FetchOpaque>; | ||
} | ||
|
||
export class BaseAgent extends Agent { | ||
#opaqueLocalStorage: AsyncLocalStorage<FetchOpaque>; | ||
|
||
constructor(options: BaseAgentOptions) { | ||
super(options); | ||
this.#opaqueLocalStorage = options.opaqueLocalStorage; | ||
} | ||
|
||
dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean { | ||
const opaque = this.#opaqueLocalStorage.getStore(); | ||
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 20)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 20)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 20)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 20)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 23)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 23)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 23)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 23)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 22)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 22)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 22)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 22)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 22)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 22)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 22)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 22)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 18)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 18)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 18)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 18)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (ubuntu-latest, 18.19.0)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 20)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 20)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 20)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 20)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 23)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 23)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 23)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 23)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 18.19.0)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 18.19.0)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 18.19.0)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 18.19.0)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 18.19.0)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 18.19.0)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 18.19.0)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 18.19.0)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 18)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 18)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 18)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 18)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 20)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 20)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 20)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 20)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 23)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 23)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 23)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 23)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 18)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 18)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 18)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (macos-latest, 18)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 22)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTP protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 22)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.lookup > should work with custom lookup on HTTPS protol
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 22)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should check ip hostname
Check failure on line 21 in src/BaseAgent.ts GitHub Actions / Node.js / Test (windows-latest, 22)test/HttpClient.test.ts > HttpClient.test.ts > clientOptions.checkAddress > should allow hostname check
|
||
(handler as any).opaque = opaque; | ||
return super.dispatch(options, handler); | ||
} | ||
} |