Inspecting request body?
See original GitHub issueI am looking for a way to verify that the JSON in my request is structured properly for the API on the server. (I don’t want to match routes or methods against certain request parameters.) Is the only way to inspect the request data via the config.data property in the .reply() method?
For example, I’m doing something like this now:
mock.onPost().reply( ({data}) => {
expect(data.items.length).not.toBe(0);
expect(data.title).toBe("my test title");
// etc...
done();
});
but using .reply() for this seems somewhat counterintuitive and I’m wondering if I’m missing something.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Inspection of the request body, headers, and cookies
Mitigate the limitations on inspecting the web request body, headers, and cookies in AWS WAF.
Read more >HTTP Request Body Inspection for Web Application Firewall
HTTP request body inspection instructs the web application firewall policy to buffer the request body in memory and inspect it before ...
Read more >Inspect HTTP requests - Beeceptor Docs
Beeceptor enables you to collect, parse, and view HTTP requests. ... Use the endpoint's dashboard to inspect headers, request body, query strings, cookies, ......
Read more >Simplest way to extract request body from POST request in ...
You can click on the "Network" tab, this will show you all of your requests and their responses.
Read more >Modify request body inspection limit settings for a configuration
Beta. Modify request body inspection limit settings for a configuration. Inspect request bodies up to a certain size. In exceptional cases, you can...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

There’s no dedicated method for this, did you have something in mind as a proposal? I was thinking it could be like this:
To verify if the request body is correct, history can be used.