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: Ensure Response#type is set correctly for CORS requests #57

Closed
wants to merge 1 commit into from

Conversation

nzakas
Copy link
Contributor

@nzakas nzakas commented Feb 20, 2025

This pull request ensures that Response#type is set to "cors" when Request#mode is set to "cors" (which is the default). Further PRs will focus on correctly setting Response#type for other values of Request#mode.

The most important changes include updating the Route class to handle response properties more effectively, adding tests for request modes, and modifying the MockServer class to ensure proper response types.

Improvements to Route class:

  • Updated the createResponse method to handle different response patterns and ensure response properties are correctly assigned. [1] [2] [3]

Enhancements to MockServer class:

  • Removed redundant url property assignment in the createResponse method.

Addition of tests for request modes:

  • Added tests in tests/custom-request.test.js to verify the mode property of CustomRequest instances.
  • Updated the createRequest function in tests/mock-server.test.js to include the mode option.
  • Added tests in tests/mock-server.test.js to check the response type based on the request mode.

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