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

Allow circular structures to be sent over the websocket, make it an error to send circular request bodies #4407

Merged
merged 18 commits into from Jun 13, 2019

Conversation

@flotwig
Copy link
Member

@flotwig flotwig commented Jun 6, 2019

  • Fixes #4346
  • Fixes #1958
  • Upgrades socket.io from 1.7.4 to 2.2.0 so that custom parsers are supported
  • Uses https://github.com/cypress-io/socket.io-circular-parser instead of Socket.io's default parser so that we can handle circular structures
  • Adds a better error if a user passes a circular request body in
    • Even with circular JSON support in the socket, request lib can't serialize a recursive body (of course), so we should warn the user that they're sending an invalid body
    • image

Thought about using flatted (the successor to circular-json), but jsperf shows it performs 50% slower: https://jsperf.com/flatted-vs-circularjson

@flotwig flotwig changed the title [WIP] Allow circular structures to be sent over the websocket [WIP] Allow circular structures to be sent over the websocket, make it an error to send circular request bodies Jun 6, 2019
@flotwig flotwig changed the title [WIP] Allow circular structures to be sent over the websocket, make it an error to send circular request bodies Allow circular structures to be sent over the websocket, make it an error to send circular request bodies Jun 7, 2019
@flotwig flotwig requested a review from Jun 7, 2019
Copy link
Member

@brian-mann brian-mann left a comment

  • use the global io instead of requiring in @packages/socket in the extension.
  • build the extension to look at the source to ensure it's not packaging up socket.io twice
  • we need to write a single "e2e / driver" test that passes in a circular dep.
  • the test could be simple like something in cypress_spec.coffee or similar. we just need to use Cypress.backend(...) and pass in an object that would cause it to normally fail

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