Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 18.188.80.46
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
unp-musonza /
node_modules /
on-headers /
Delete
Unzip
Name
Size
Permission
Date
Action
HISTORY.md
296
B
-rw-r--r--
2015-09-30 03:43
LICENSE
1.06
KB
-rw-r--r--
2014-05-13 23:58
README.md
1.88
KB
-rw-r--r--
2015-02-15 19:58
index.js
2.02
KB
-rw-r--r--
2015-09-30 03:18
package.json
1.77
KB
-rw-r--r--
2021-02-04 21:24
Save
Rename
# on-headers [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] [![Node.js Version][node-version-image]][node-version-url] [![Build Status][travis-image]][travis-url] [![Test Coverage][coveralls-image]][coveralls-url] Execute a listener when a response is about to write headers. ## Installation ```sh $ npm install on-headers ``` ## API ```js var onHeaders = require('on-headers') ``` ### onHeaders(res, listener) This will add the listener `listener` to fire when headers are emitted for `res`. The listener is passed the `response` object as it's context (`this`). Headers are considered to be emitted only once, right before they are sent to the client. When this is called multiple times on the same `res`, the `listener`s are fired in the reverse order they were added. ## Examples ```js var http = require('http') var onHeaders = require('on-headers') http .createServer(onRequest) .listen(3000) function addPoweredBy() { // set if not set by end of request if (!this.getHeader('X-Powered-By')) { this.setHeader('X-Powered-By', 'Node.js') } } function onRequest(req, res) { onHeaders(res, addPoweredBy) res.setHeader('Content-Type', 'text/plain') res.end('hello!') } ``` ## Testing ```sh $ npm test ``` ## License [MIT](LICENSE) [npm-image]: https://img.shields.io/npm/v/on-headers.svg [npm-url]: https://npmjs.org/package/on-headers [node-version-image]: https://img.shields.io/node/v/on-headers.svg [node-version-url]: http://nodejs.org/download/ [travis-image]: https://img.shields.io/travis/jshttp/on-headers/master.svg [travis-url]: https://travis-ci.org/jshttp/on-headers [coveralls-image]: https://img.shields.io/coveralls/jshttp/on-headers/master.svg [coveralls-url]: https://coveralls.io/r/jshttp/on-headers?branch=master [downloads-image]: https://img.shields.io/npm/dm/on-headers.svg [downloads-url]: https://npmjs.org/package/on-headers