Nonsense Placement Mandatory
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    popsicle-statuspublic

    Popsicle Status

    Greenkeeper badge

    NPM version NPM downloads Build status Test coverage

    Reject responses on HTTP failure status codes (404, 500, etc).

    Installation

    npm install popsicle-status --save

    Usage

    var request = require('popsicle')
    var status = require('popsicle-status')
     
    request('/users.json')
      .use(status())
      .catch(function (error) {
        console.log(error.type) //=> "EINVALIDSTATUS" 
        console.log(error.message) //=> "Invalid HTTP status, 404, should be between 200 and 399" 
        console.log(error.status) //=> 404 
        console.log(error.popsicle) //=> Popsicle#Request 
      })
    • status() Use default status codes (min: 200, max: 399)
    • status(number) Set the only valid HTTP status code
    • status(number, number) Set both the minimum and maximum HTTP status codes

    TypeScript

    Includes a type definition for TypeScript.

    License

    MIT

    install

    npm i popsicle-status

    Downloadsweekly downloads

    71,821

    version

    2.0.1

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar