Skip to content

Commit

Permalink
chore: swap out headers-polyfill type for node-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
kanadgupta committed Sep 14, 2023
1 parent 4827139 commit 5a2a9e3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
6 changes: 3 additions & 3 deletions __tests__/helpers/get-api-mock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Headers } from 'headers-polyfill';
import type { ResponseTransformer } from 'msw';
import type { Headers } from 'node-fetch';

import { rest } from 'msw';
import nock from 'nock';
Expand Down Expand Up @@ -80,9 +80,9 @@ export function getAPIMockMSW(
try {
validateHeaders(req.headers, basicAuthUser, expectedReqHeaders);
let responseTransformer: ResponseTransformer;
if (response.json) {
if (response?.json) {
responseTransformer = ctx.json(response.json);
} else if (response.text) {
} else if (response?.text) {
responseTransformer = ctx.text(response.text);
}
return res(ctx.status(status), responseTransformer);
Expand Down
13 changes: 0 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
"ajv": "^8.11.0",
"alex": "^11.0.0",
"eslint": "^8.47.0",
"headers-polyfill": "^4.0.1",
"husky": "^8.0.0",
"js-yaml": "^4.1.0",
"knip": "^2.24.0",
Expand Down

0 comments on commit 5a2a9e3

Please sign in to comment.