forked from orval-labs/orval
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.ts
More file actions
23 lines (20 loc) · 689 Bytes
/
node.ts
File metadata and controls
23 lines (20 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { setupServer } from 'msw/node';
import { http, HttpResponse } from 'msw';
import {
getPetsMock,
getListPetsResponseMock,
getSearchPetsResponseMock,
} from './endpoints/pets/pets.msw';
// Additional handlers for non-versioned endpoints (no-transformer and custom-instance)
const nonVersionedHandlers = [
// Handler for /pets (no version prefix)
http.get('*/pets', () => {
return HttpResponse.json(getListPetsResponseMock());
}),
// Handler for /search (no version prefix)
http.get('*/search', () => {
return HttpResponse.json(getSearchPetsResponseMock());
}),
];
const server = setupServer(...getPetsMock(), ...nonVersionedHandlers);
export { server };