request-object-fingerprint

1.0.0 • Public • Published

request-object-fingerprint

generate a unique string from a request object for use as a cache key

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install request-object-fingerprint --save

Usage

var fingerprint = require("request-object-fingerprint")
 
var request = {
  method: 'GET',
  url: '/flowers',
  qs: {color: 'red', fragrance: 'sweet'},
  headers: {bearer: 'beholder'}
}
 
fingerprint(request)
// => acl:e25f8d798636632ee5c91d27defb6749
 
// Set a custom prefix
fingerprint(request, {prefix: 'baz'})
// => baz:e25f8d798636632ee5c91d27defb6749

Tests

npm install
npm test

Dependencies

None

Dev Dependencies

  • code: assertion library
  • mocha: simple, flexible, fun test framework
  • standard: JavaScript Standard Style

License

MIT

Package Sidebar

Install

npm i request-object-fingerprint

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • zeke