-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
Bug 🐛help wantedIssues that are free to take by anyone interestedIssues that are free to take by anyone interested
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
9.12.4
Node.js Version
20.15.1
Mode
WDIO Testrunner
Which capabilities are you using?
What happened?
Mocks are no longer returning the bodies that are specified in the mock. Instead, they return in the format of:
{
"type": "string",
"value": "{'whateverYouSpecifiedAsThe': 'mock'}"
}
What is your expected behavior?
Mocks return the value specified, as is.
How to reproduce the bug.
Here's the code I'm using:
const mockResponse = {
data: {
someProperty: 123,
}
};
const theMock = await browser.mock('https://some.site.com/someEndpoint', { method: 'POST' });
theMock.respond(mockResponse, {
statusCode: 200,
headers: {
'access-control-allow-origin': '*',
'access-control-allow-methods': '*',
'access-control-allow-headers': '*',
'content-type': 'application/json; charset=utf-8'
},
fetchResponse: false
});In the network console in the browser, I will then see the endpoint returning this:
{
"type": "string",
"value": "{\"data\":{\"someProperty\": 123}}"
}
I believe this may have been introduced in #14360.
Relevant log output
Not seeing anything in the log relevant here.Code of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Bug 🐛help wantedIssues that are free to take by anyone interestedIssues that are free to take by anyone interested