@@ -4,7 +4,7 @@ module.exports = function (classes) {
44 var
55 net = require ( 'net' ) ,
66 http = require ( 'http' ) ,
7- extend = require ( 'util' ) . _extend ,
7+ extend = require ( 'object-assign' ) ,
88 JsonParser = require ( 'jsonparse' ) ,
99
1010 UNAUTHORIZED = 'Unauthorized' ,
@@ -123,7 +123,7 @@ module.exports = function (classes) {
123123 'Content-Length' : 0 ,
124124 'Access-Control-Allow-Headers' : 'Accept, Authorization, Content-Type'
125125 } ;
126- headers = extend ( self . opts . headers , headers ) ;
126+ headers = extend ( { } , headers , self . opts . headers ) ;
127127 res . writeHead ( 200 , headers ) ;
128128 res . end ( ) ;
129129 return ;
@@ -173,7 +173,7 @@ module.exports = function (classes) {
173173 headers [ 'Content-Length' ] = 0 ;
174174 }
175175
176- headers = extend ( self . opts . headers , headers ) ;
176+ headers = extend ( { } , headers , self . opts . headers ) ;
177177
178178 if ( ! conn . isStreaming ) {
179179 res . writeHead ( 200 , headers ) ;
@@ -377,10 +377,12 @@ module.exports = function (classes) {
377377 'id' : null
378378 } ) ;
379379 custom_headers = custom_headers || { } ;
380- var headers = extend ( custom_headers , { 'Content-Type' : 'application/json' ,
381- 'Content-Length' : Buffer . byteLength ( message ) ,
382- 'Access-Control-Allow-Headers' : 'Content-Type' ,
383- 'Allow' : 'POST' } ) ;
380+ var headers = extend ( {
381+ 'Content-Type' : 'application/json' ,
382+ 'Content-Length' : Buffer . byteLength ( message ) ,
383+ 'Access-Control-Allow-Headers' : 'Content-Type' ,
384+ 'Allow' : 'POST'
385+ } , custom_headers ) ;
384386
385387 /*if (code === 401) {
386388 headers['WWW-Authenticate'] = 'Basic realm=' + 'JSON-RPC' + '';
0 commit comments