Skip to content
This repository has been archived by the owner on May 2, 2020. It is now read-only.

Wrap request's idiosyncratic callback format with a standard Node-style callback

License

Notifications You must be signed in to change notification settings

metabolize/request-shim-for-callbacks

Repository files navigation

request-shim-for-callbacks

Wrap request's idiosyncratic callback format with a standard Node-style callback.

Consider any status code not matching the expected status an error.

Usage

var request = require('request'),
    verifyResponseStatus = require('request-shim-for-callbacks');

request.get(
    {
        url: '/monitoring/raw',
        body: query,
    },
    verifyResponseStatus(200, function (err, data) {
        if (err) {
            callback(err, null);
        } else {
            console.log(data);

            callback(null, data);
        }
    })
);

Contribute

  • Issue Tracker: github.com/bodylabs/request-shim-for-callback/issues
  • Source Code: github.com/bodylabs/request-shim-for-callbacks

Pull requests welcome!

License

The project is licensed under the two-clause BSD license.

About

Wrap request's idiosyncratic callback format with a standard Node-style callback

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •