index.js
function onHeaders (res, listener) {
  if (!res) {
    throw new TypeError('argument res is required')
  }

  if (typeof listener !== 'function') {
    throw new TypeError('argument listener must be a function')
  }

  res.writeHead = createWriteHead(res.writeHead, listener)
}
function onHeaders (res, listener) {
  if (!res) {
    throw new TypeError('argument res is required')
  }

  if (typeof listener !== 'function') {
    throw new TypeError('argument listener must be a function')
  }

  res.writeHead = createWriteHead(res.writeHead, listener)
}
function onHeaders ( res , listener ) { if ( ! res ) { throw new TypeError ( 'argument res is required' ) } if ( typeof listener !== 'function' ) { throw new TypeError ( 'argument listener must be a function' ) } res . writeHead = createWriteHead ( res . writeHead , listener ) }
Execute a listener when a response is about to write headers.

@param {object} res
@return {function} listener
@public
Execute a listener when a response is about to write headers .