File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -53,16 +53,21 @@ extend(Connection.prototype, {
5353 var body = opts . body ;
5454 var headers = { 'content-type' : 'text/plain' } ;
5555
56- if ( body && typeof body === 'object' ) {
57- if ( opts . ld ) {
58- body = body . map ( function ( obj ) {
59- return JSON . stringify ( obj ) ;
60- } ) . join ( '\r\n' ) + '\r\n' ;
61- headers [ 'content-type' ] = 'application/x-ldjson' ;
56+ if ( body ) {
57+ if ( typeof body === 'object' ) {
58+ if ( opts . ld ) {
59+ body = body . map ( function ( obj ) {
60+ return JSON . stringify ( obj ) ;
61+ } ) . join ( '\r\n' ) + '\r\n' ;
62+ headers [ 'content-type' ] = 'application/x-ldjson' ;
63+ } else {
64+ body = JSON . stringify ( body ) ;
65+ headers [ 'content-type' ] = 'application/json' ;
66+ }
6267 } else {
63- body = JSON . stringify ( body ) ;
64- headers [ 'content-type' ] = 'application/json' ;
68+ body = String ( body ) ;
6569 }
70+ headers [ 'content-length' ] = body . length ;
6671 }
6772
6873 this . _request ( {
You can’t perform that action at this time.
0 commit comments