Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(MockHttpSocket): forward tls getCipher calls #688

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jonathansamines
Copy link

We are currently are experiencing an issue because our http client relies on the TLSSocket.getCipher() method, which msw doesn't currently provide, which is causing the following error (stack trace redacted):

[dev]  ⨯ unhandledRejection: TypeError: this.getCipher is not a function
[dev]     at MockHttpSocket.<anonymous> (/path/to/location/custom-client.js:L:C)
[dev]     at Object.onceWrapper (node:events:633:28)
[dev]     at MockHttpSocket.emit (node:events:519:28)
[dev]     at MockHttpSocket.emit (node:domain:488:12)
[dev]     at MockHttpSocket.emit (webpack-internal:///(rsc)/./node_modules/msw/node_modules/@mswjs/interceptors/lib/node/chunk-KEULKBUZ.mjs:429:12)
[dev]     at MockHttpSocket.mockConnect (webpack-internal:///(rsc)/./node_modules/msw/node_modules/@mswjs/interceptors/lib/node/chunk-KEULKBUZ.mjs:593:12)
[dev]     at MockHttpSocket.respondWith (webpack-internal:///(rsc)/./node_modules/msw/node_modules/@mswjs/interceptors/lib/node/chunk-KEULKBUZ.mjs:518:10)
[dev]     at Object.onResponse (webpack-internal:///(rsc)/./node_modules/msw/node_modules/@mswjs/interceptors/lib/node/chunk-KEULKBUZ.mjs:946:18)
[dev]     at handleResponse (webpack-internal:///(rsc)/./node_modules/msw/node_modules/@mswjs/interceptors/lib/node/chunk-M4WQE4TR.mjs:107:21)
[dev]     at handleRequest (webpack-internal:///(rsc)/./node_modules/msw/node_modules/@mswjs/interceptors/lib/node/chunk-M4WQE4TR.mjs:193:12)
[dev]     at processTicksAndRejections (node:internal/process/task_queues:95:5)

Note: I don't know whether or not this is the proper way to fix this issue, but a quick search lead to #556, which introduces this pattern

@jonathansamines
Copy link
Author

Hey @kettanaito, any chance you can review these changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant