Socket
Book a DemoInstallSign in
Socket

http-error-stream

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-error-stream

Stream an error over http

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

http-error-stream stability

npm version build status test coverage downloads js-standard-style

Stream an error over http. Takes a server-error error and streams it back out.

Usage

const errorStream = require('http-error-stream')
const serverError = require('server-error')
const bole = require('bole')
const http = require('http')

const log = bole('my-service')
const error = serverError(log)

http.createServer(function (req, res) {
  const err = error.client('oh no!')
  // set statusCode, content-type and stream error as JSON
  errorStream(req, res, err).pipe(res)
}).listen

Installation

$ npm install http-error-stream

License

MIT

Keywords

http

FAQs

Package last updated on 29 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts