(url: URL, opts: RequestInit)
| 16 | */ |
| 17 | export class FetchRequest extends WebDriverRequest { |
| 18 | async fetch (url: URL, opts: RequestInit) { |
| 19 | const response = await fetch(url, opts as UndiciRequestInit) as unknown as Promise<Response> |
| 20 | if (opts.method === 'DELETE') { |
| 21 | // regex should only target the delete session request, not other |
| 22 | // delete requests, full list: https://www.w3.org/TR/webdriver2/#endpoints |
| 23 | const match = url.pathname.match(/\/session\/([^/]+)$/) |
| 24 | const sessionId = match?.[1] |
| 25 | if (sessionId) { |
| 26 | this.cleanupSessionDispatcher(sessionId) |
| 27 | } |
| 28 | } |
| 29 | return response |
| 30 | } |
| 31 | |
| 32 | private getDispatcher(url: URL, options: RequestOptions, sessionId?: string): Dispatcher { |
| 33 | if (sessionId && SESSION_DISPATCHERS.has(sessionId)) { |
nothing calls this directly
no test coverage detected