Logo: Relish

  1. Sign in

Project: Gavel 1.2.0

Gavel.js - JavaScript implementation

Gavel.js - JavaScript implementation

GitHub repository npm version
Build Status

Gavel.js is JavaScript implementation of the Gavel specification.

Installation

npm install gavel

Introduction

Usage from JavaScript

const gavel = require('gavel');

const actualResponse = {
  'statusCode': '200',
  'headers': {
    'content-type': 'application/json',
    'date': 'Wed, 03 Jul 2013 13:30:53 GMT',
    'server': 'gunicorn/0.17.4',
    'content-length': '30',
    'connection': 'keep-alive'
  },
  'body': '{\n  "origin": "94.113.241.2"\n}'
};
const expectedResponse = {
  'statusCode': '200',
  'headers': {
    'content-type': 'application/json',
    'date': 'Wed, 03 Jul 2013 13:30:53 GMT',
    'server': 'gunicorn/0.17.4',
    'content-length': '30',
    'connection': 'keep-alive'
  },
  'body': '{\n  "origin": "94.113.241.2"\n}'
};

gavel.isValid(actualResponse, expectedResponse, 'response', (err, result) => {
  if (err) {
    console.error(err);
  } else {
    console.log(result);
  }
});

Command-line interface

Gavel.js implements CLI according to the common Command-line interface specification.

Topics

  1. Request Async API
  2. request Sync API
  3. Response Async API
  4. Response Sync API

Last published almost 3 years ago by honzajavorek.