0.0.2 • Published 10 years ago

node-rest-diff v0.0.2

Weekly downloads
101
License
MIT
Repository
-
Last release
10 years ago

node-rest-diff

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

Install from npm:

$ npm install node-rest-diff

Usage

Using the method.

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();

Comparison of simple REST API response.

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();

MultiCompare REST API multiple responses.

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();

Result

result

Link