fix: Ensure Response#type is set correctly for CORS requests #57
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request ensures that
Response#type
is set to"cors"
whenRequest#mode
is set to"cors"
(which is the default). Further PRs will focus on correctly settingResponse#type
for other values ofRequest#mode
.The most important changes include updating the
Route
class to handle response properties more effectively, adding tests for request modes, and modifying theMockServer
class to ensure proper response types.Improvements to
Route
class:createResponse
method to handle different response patterns and ensure response properties are correctly assigned. [1] [2] [3]Enhancements to
MockServer
class:url
property assignment in thecreateResponse
method.Addition of tests for request modes:
tests/custom-request.test.js
to verify themode
property ofCustomRequest
instances.createRequest
function intests/mock-server.test.js
to include themode
option.tests/mock-server.test.js
to check the response type based on the request mode.