I am planning to use mock server from mock-server.org for a cypress project.
Is there any way to get requests body from the server so I can validate the schema and the content?
Asked
Active
Viewed 252 times
0

MiklosBalazsi
- 161
- 9
1 Answers
0
You can validate the received body in your expectation by setting something like the "regex body matcher":
{
"httpRequest": {
"method": "POST",
"path": "/endpoint",
"body": {
"regex": ".*(this-should-be-there).*"
}
}
}
Then verify that this expectation has matched.
To validate schema, ou can use the "json schema body matcher".
See https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi/5.12.x#/Body to know all types of body you can validate.

Alcalyn
- 1,531
- 14
- 25