Skip to content

Commit

Permalink
feat: update to @mswjs/interceptors 0.13.3 (#1095)
Browse files Browse the repository at this point in the history
* feat: update to @mswjs/interceptors 0.13.3

* chore: use the "headers-polyfill" package (#1102)
  • Loading branch information
kettanaito authored Feb 19, 2022
1 parent b4d412a commit e288d18
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 33 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@
"sideEffects": false,
"dependencies": {
"@mswjs/cookies": "^0.1.7",
"@mswjs/interceptors": "^0.12.7",
"@mswjs/interceptors": "^0.13.3",
"@open-draft/until": "^1.0.3",
"@types/cookie": "^0.4.1",
"@types/js-levenshtein": "^1.1.1",
"chalk": "4.1.1",
"chokidar": "^3.4.2",
"cookie": "^0.4.2",
"graphql": "^16.3.0",
"headers-utils": "^3.0.2",
"headers-polyfill": "^3.0.3",
"inquirer": "^8.2.0",
"is-node-process": "^1.0.1",
"js-levenshtein": "^1.1.6",
Expand Down
2 changes: 1 addition & 1 deletion src/context/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isNodeProcess } from 'is-node-process'
import { Headers } from 'headers-utils'
import { Headers } from 'headers-polyfill'
import { MockedRequest } from '../handlers/RequestHandler'

const useFetch: (input: RequestInfo, init?: RequestInit) => Promise<Response> =
Expand Down
2 changes: 1 addition & 1 deletion src/context/set.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { objectToHeaders } from 'headers-utils'
import { objectToHeaders } from 'headers-polyfill'
import { ResponseTransformer } from '../response'

export type HeadersObject<KeyType extends string = string> = Record<
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/GraphQLHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @jest-environment jsdom
*/
import { OperationTypeNode, parse } from 'graphql'
import { Headers } from 'headers-utils/lib'
import { Headers } from 'headers-polyfill/lib'
import { context } from '..'
import { createMockedRequest } from '../../test/support/utils'
import { response } from '../response'
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/RequestHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Headers } from 'headers-utils'
import { Headers } from 'headers-polyfill'
import { MockedResponse, response, ResponseComposition } from '../response'
import { getCallFrame } from '../utils/internal/getCallFrame'
import { isIterable } from '../utils/internal/isIterable'
Expand Down
2 changes: 1 addition & 1 deletion src/response.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Headers } from 'headers-utils'
import { Headers } from 'headers-polyfill'
import { compose } from './utils/internal/compose'
import { NetworkError } from './utils/NetworkError'

Expand Down
2 changes: 1 addition & 1 deletion src/setupWorker/glossary.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FlatHeadersObject } from 'headers-utils'
import { FlatHeadersObject } from 'headers-polyfill'
import { StrictEventEmitter } from 'strict-event-emitter'
import {
LifeCycleEventEmitter,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/handleRequest.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Headers } from 'headers-utils'
import { Headers } from 'headers-polyfill'
import { StrictEventEmitter } from 'strict-event-emitter'
import { ServerLifecycleEventsMap } from '../node/glossary'
import { createMockedRequest } from '../../test/support/utils'
Expand Down
2 changes: 1 addition & 1 deletion src/utils/internal/parseGraphQLRequest.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @jest-environment jsdom
*/
import { Headers } from 'headers-utils'
import { Headers } from 'headers-polyfill'
import { createMockedRequest } from '../../../test/support/utils'
import { parseGraphQLRequest } from './parseGraphQLRequest'

Expand Down
2 changes: 1 addition & 1 deletion src/utils/internal/parseMultipartData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { stringToHeaders } from 'headers-utils'
import { stringToHeaders } from 'headers-polyfill'
import { DefaultRequestMultipartBody } from '../../handlers/RequestHandler'

interface ParsedContentHeaders {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/logging/prepareRequest.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Headers } from 'headers-utils'
import { Headers } from 'headers-polyfill'
import { prepareRequest } from './prepareRequest'

test('converts request headers into an object', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/logging/prepareResponse.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { objectToHeaders } from 'headers-utils'
import { objectToHeaders } from 'headers-polyfill'
import { SerializedResponse } from '../../setupWorker/glossary'
import { parseBody } from '../request/parseBody'

Expand Down
2 changes: 1 addition & 1 deletion src/utils/request/parseWorkerRequest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Headers } from 'headers-utils'
import { Headers } from 'headers-polyfill'
import { RestRequest } from '../../handlers/RestHandler'
import { ServiceWorkerIncomingRequest } from '../../setupWorker/glossary'
import { setRequestCookies } from './setRequestCookies'
Expand Down
2 changes: 1 addition & 1 deletion test/msw-api/setup-server/scenarios/xhr.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { rest } from 'msw'
import { setupServer } from 'msw/node'
import { stringToHeaders } from 'headers-utils'
import { stringToHeaders } from 'headers-polyfill'

describe('setupServer / XHR', () => {
const server = setupServer(
Expand Down
2 changes: 1 addition & 1 deletion test/support/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as path from 'path'
import { Headers } from 'headers-utils'
import { Headers } from 'headers-polyfill'
import { MockedRequest } from './../../src'
import { uuidv4 } from '../../src/utils/internal/uuidv4'
import { ChildProcess } from 'child_process'
Expand Down
41 changes: 24 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1692,16 +1692,16 @@
"@types/set-cookie-parser" "^2.4.0"
set-cookie-parser "^2.4.6"

"@mswjs/interceptors@^0.12.7":
version "0.12.7"
resolved "https://registry.yarnpkg.com/@mswjs/interceptors/-/interceptors-0.12.7.tgz#0d1cd4cd31a0f663e0455993951201faa09d0909"
integrity sha512-eGjZ3JRAt0Fzi5FgXiV/P3bJGj0NqsN7vBS0J0FO2AQRQ0jCKQS4lEFm4wvlSgKQNfeuc/Vz6d81VtU3Gkx/zg==
"@mswjs/interceptors@^0.13.3":
version "0.13.3"
resolved "https://registry.yarnpkg.com/@mswjs/interceptors/-/interceptors-0.13.3.tgz#07dff2fd2ef46ee164f732ae50128c634663063e"
integrity sha512-YGC25Rp7ugywBL1bqvy1fJ9HHvQJ9yEJcYLbHdsQCiQ89zmnY0b0ZfJAMqXHhTOHV6oKaunN7y0fdWkRlfuTIg==
dependencies:
"@open-draft/until" "^1.0.3"
"@xmldom/xmldom" "^0.7.2"
debug "^4.3.2"
headers-utils "^3.0.2"
outvariant "^1.2.0"
"@xmldom/xmldom" "^0.7.5"
debug "^4.3.3"
headers-polyfill "^3.0.3"
outvariant "^1.2.1"
strict-event-emitter "^0.2.0"

"@nodelib/[email protected]":
Expand Down Expand Up @@ -2397,10 +2397,10 @@
"@webassemblyjs/ast" "1.11.1"
"@xtuc/long" "4.2.2"

"@xmldom/xmldom@^0.7.2":
version "0.7.2"
resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.7.2.tgz#d920079e66806b2626b5311955f6a7c4bed1cba8"
integrity sha512-t/Zqo0ewes3iq6zGqEqJNUWI27Acr3jkmSUNp6E3nl0Z2XbtqAG5XYqPNLdYonILmhcxANsIidh69tHzjXtuRg==
"@xmldom/xmldom@^0.7.5":
version "0.7.5"
resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.7.5.tgz#09fa51e356d07d0be200642b0e4f91d8e6dd408d"
integrity sha512-V3BIhmY36fXZ1OtVcI9W+FxQqxVLsPKcNjWigIaa81dLC9IolJl5Mt4Cvhmr0flUnjSpTdrbMTSbXqYqV5dT6A==

"@xtuc/ieee754@^1.2.0":
version "1.2.0"
Expand Down Expand Up @@ -3865,6 +3865,13 @@ debug@^4.3.2:
dependencies:
ms "2.1.2"

debug@^4.3.3:
version "4.3.3"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664"
integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==
dependencies:
ms "2.1.2"

decamelize-keys@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9"
Expand Down Expand Up @@ -5113,6 +5120,11 @@ has@^1.0.3:
dependencies:
function-bind "^1.1.1"

headers-polyfill@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-3.0.3.tgz#222bd9a6b5a1f610ad563473efb0d34a13eb7ebc"
integrity sha512-Ak5m549Y+5vBtWNnIUcyARJjF0tQpINuy3+vOqG8tK/qjF0itYhAPgrzJc0zsZJh7AX8PalzICMPuWIqHpZlEA==

headers-utils@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/headers-utils/-/headers-utils-3.0.2.tgz#dfc65feae4b0e34357308aefbcafa99c895e59ef"
Expand Down Expand Up @@ -7072,11 +7084,6 @@ os-tmpdir@~1.0.2:
resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=

outvariant@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/outvariant/-/outvariant-1.2.0.tgz#c904d30dc36d70d93902b13641aa1fda69ae8c0c"
integrity sha512-OKEOPXtvIeSohFl9avZwm1BL/awT49PV/HQHyc0RHcdICkvj5XP+j+IHhsSoV7nT5gDtMJTlWXqVpA/F8yoi2A==

outvariant@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/outvariant/-/outvariant-1.2.1.tgz#e630f6cdc1dbf398ed857e36f219de4a005ccd35"
Expand Down

0 comments on commit e288d18

Please sign in to comment.