         else
           handler
   handlers
+
+getHeaderName = (headers, searchName) ->
+  searchName = searchName.toLowerCase()
+  for name, value of headers
+    if name.toLowerCase() == searchName
+      return name
 
 exports.create = (options) ->
   # Short circuit if no plugins were provided

        headers = reasonPhrase
      headers or= res.headers

      contentType = headers?['Content-Type']?.split(';')[0]

      if handlers[contentType]
        # Divert the content stream for further processing

            res.write = write
            res.end = end

            headers[getHeaderName headers, 'content-length'] = content.length

            # Send everything on the way
            res.writeHead statusCode, headers
