MCPcopy Create free account
hub / github.com/webdriverio/webdriverio / fetch

Method fetch

packages/webdriver/src/request/node.ts:18–30  ·  view source on GitHub ↗
(url: URL, opts: RequestInit)

Source from the content-addressed store, hash-verified

16 */
17export 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)) {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected