Spaces:
Paused
Paused
Download node_modules/msw/src/native/index.ts from sam522/GenAI_Course: direct link, hf CLI and curl.
- Browser
- Download file 879 Bytes
-
https://huggingface.co/spaces/sam522/GenAI_Course/resolve/2fd35fe0dbbccdd816285ca3b098a170940cfdef/node_modules/msw/src/native/index.ts
- Command line
-
hf download hf://spaces/sam522/GenAI_Course@2fd35fe0dbbccdd816285ca3b098a170940cfdef/node_modules/msw/src/native/index.ts
-
curl -L -o index.ts https://huggingface.co/spaces/sam522/GenAI_Course/resolve/2fd35fe0dbbccdd816285ca3b098a170940cfdef/node_modules/msw/src/native/index.ts
879 Bytes
| import { FetchInterceptor } from '@mswjs/interceptors/fetch' | |
| import { XMLHttpRequestInterceptor } from '@mswjs/interceptors/XMLHttpRequest' | |
| import type { RequestHandler } from '~/core/handlers/RequestHandler' | |
| import { SetupServerCommonApi } from '../node/SetupServerCommonApi' | |
| /** | |
| * Sets up a requests interception in React Native with the given request handlers. | |
| * @param {RequestHandler[]} handlers List of request handlers. | |
| * | |
| * @see {@link https://mswjs.io/docs/api/setup-server `setupServer()` API reference} | |
| */ | |
| export function setupServer( | |
| ...handlers: Array<RequestHandler> | |
| ): SetupServerCommonApi { | |
| // Provision request interception via patching the `XMLHttpRequest` class only | |
| // in React Native. There is no `http`/`https` modules in that environment. | |
| return new SetupServerCommonApi( | |
| [FetchInterceptor, XMLHttpRequestInterceptor], | |
| handlers, | |
| ) | |
| } | |