{
  "name": "on-headers",
  "description": "Execute a listener when a response is about to write headers",
  "version": "1.0.1",
  "author": {
    "name": "Douglas Christopher Wilson",
    "email": "doug@somethingdoug.com"
  },
  "license": "MIT",
  "keywords": [
    "event",
    "headers",
    "http",
    "onheaders"
  ],
  "repository": {
    "type": "git",
    "url": "git://github.com/jshttp/on-headers"
  },
  "dependencies": {},
  "devDependencies": {
    "istanbul": "0.3.21",
    "mocha": "2.3.3",
    "supertest": "1.1.0"
  },
  "files": [
    "LICENSE",
    "HISTORY.md",
    "README.md",
    "index.js"
  ],
  "engines": {
    "node": ">= 0.8"
  },
  "scripts": {
    "test": "mocha --reporter spec --bail --check-leaks test/",
    "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
    "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
  },
  "readme": "# on-headers\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Node.js Version][node-version-image]][node-version-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nExecute a listener when a response is about to write headers.\n\n## Installation\n\n```sh\n$ npm install on-headers\n```\n\n## API\n\n```js\nvar onHeaders = require('on-headers')\n```\n\n### onHeaders(res, listener)\n\nThis will add the listener `listener` to fire when headers are emitted for `res`.\nThe listener is passed the `response` object as it's context (`this`). Headers are\nconsidered to be emitted only once, right before they are sent to the client.\n\nWhen this is called multiple times on the same `res`, the `listener`s are fired\nin the reverse order they were added.\n\n## Examples\n\n```js\nvar http = require('http')\nvar onHeaders = require('on-headers')\n\nhttp\n.createServer(onRequest)\n.listen(3000)\n\nfunction addPoweredBy() {\n  // set if not set by end of request\n  if (!this.getHeader('X-Powered-By')) {\n    this.setHeader('X-Powered-By', 'Node.js')\n  }\n}\n\nfunction onRequest(req, res) {\n  onHeaders(res, addPoweredBy)\n\n  res.setHeader('Content-Type', 'text/plain')\n  res.end('hello!')\n}\n```\n\n## Testing\n\n```sh\n$ npm test\n```\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/on-headers.svg\n[npm-url]: https://npmjs.org/package/on-headers\n[node-version-image]: https://img.shields.io/node/v/on-headers.svg\n[node-version-url]: http://nodejs.org/download/\n[travis-image]: https://img.shields.io/travis/jshttp/on-headers/master.svg\n[travis-url]: https://travis-ci.org/jshttp/on-headers\n[coveralls-image]: https://img.shields.io/coveralls/jshttp/on-headers/master.svg\n[coveralls-url]: https://coveralls.io/r/jshttp/on-headers?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/on-headers.svg\n[downloads-url]: https://npmjs.org/package/on-headers\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/jshttp/on-headers/issues"
  },
  "homepage": "https://github.com/jshttp/on-headers",
  "_id": "on-headers@1.0.1",
  "dist": {
    "shasum": "aabec7167f9701cb032d998eb62b85aca7138201"
  },
  "_from": "on-headers@~1.0.0",
  "_resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz"
}
