Permalink
Browse files

If the configuration doesn't come with headers, don't waste memory cr…

…eating a header object
  • Loading branch information...
1 parent a1f2263 commit eb32dd55c744d3b449cea27fc785ea4ee0fc0827 @partheseas committed Oct 11, 2012
Showing with 2 additions and 4 deletions.
  1. +2 −4 trailer.js
View
@@ -112,9 +112,7 @@ tl.hitch = function ( conf ) {
return false
}
- !conf.headers&&( conf.headers = {} )
-
- for ( prop in basics.headers ) if ( basics.headers.hasOwnProperty( prop ) && !conf.headers.hasOwnProperty( prop ) ) {
+ if ( conf.headers ) for ( prop in basics.headers ) if ( basics.headers.hasOwnProperty( prop ) && !conf.headers.hasOwnProperty( prop ) ) {
conf.headers[ prop ] = basics.headers[ prop ]
}
@@ -286,7 +284,7 @@ server.on( "request", function ( i, o ) {
o.emitter = i.conf._emitter,
o.stream = o,
o.status = 500,
- o.headers = Object.copy( i.conf.headers )
+ o.headers = Object.copy( i.conf.headers || basics.headers )
o.body = "";
o.headers.Date = i.received.toUTCString()

0 comments on commit eb32dd5

Please sign in to comment.