daveslab
daveslab

Reputation: 10320

How to intercept requests in JSON Server?

I'm trying to integrate JSON server with a test project that I'm working on, but one of my JS libraries, which handles the Ajax requests, formats the data in a particular way before submitting that I do not want. Is there an easy way in JSON server to intercept the incoming and outgoing requests to change the data a bit?

In the actual project, this logic will have to be at the level of the controller, but I'm far from implementing that for the moment.

Upvotes: 1

Views: 909

Answers (1)

daveslab
daveslab

Reputation: 10320

As it turns out, the answer to my question was in the README that I hadn't read well enough. You need to use the router.render() option to modify the requests and the responses to your liking.

Upvotes: 2

Related Questions