Comparison of REST API response for Node.js.
This library is used to perform a comparison of the response of REST API.
(Corresponding to only json format at the moment)
Install from npm:
$ npm install node-rest-diff
var restdiff = require('node-rest-diff');
var args = {
};
// Registering a comparison
// httpMethod : GET or POST or PUT or PATCH or DELETE
// target1 : Resources to be compared
// target2 : Resources to be compared
// args : Required settings in node-rest-client
restdiff.add(httpMethod, target1, target2, args);
// Comparison start
restdiff.compare();
var restdiff = require('node-rest-diff');
var args = {
headers:{
"Content-Type": "application/json"
}
};
restdiff.add('GET', 'http://localhost:3000/v1/users/1', 'http://localhost:3000/v2/users/1', args);
restdiff.compare();
var restdiff = require('node-rest-diff');
var args = {
headers:{
"Content-Type": "application/json"
}
};
restdiff.add('GET', 'http://localhost:3000/v1/users/1', 'http://localhost:3000/v2/users/1', args);
restdiff.add('GET', 'http://localhost:3000/v1/roles/1', 'http://localhost:3000/v2/roles/1', args);
restdiff.add('GET', 'http://localhost:3000/v1/groups/1', 'http://localhost:3000/v2/groups/1', args);
restdiff.compare();