@@ -46,6 +46,10 @@ describe('WebService', function() {
46
46
var web3 = new WebService ( { node : defaultNode } ) ;
47
47
web3 . enableSocketRPC . should . equal ( WebService . DEFAULT_SOCKET_RPC ) ;
48
48
} ) ;
49
+ it ( 'will set configuration options for max payload' , function ( ) {
50
+ var web = new WebService ( { node : defaultNode , jsonRequestLimit : '200kb' } ) ;
51
+ web . jsonRequestLimit . should . equal ( '200kb' ) ;
52
+ } ) ;
49
53
} ) ;
50
54
51
55
describe ( '#start' , function ( ) {
@@ -75,6 +79,39 @@ describe('WebService', function() {
75
79
done ( ) ;
76
80
} ) ;
77
81
} ) ;
82
+ it ( 'should pass json request limit to json body parser' , function ( done ) {
83
+ var node = new EventEmitter ( ) ;
84
+ var jsonStub = sinon . stub ( ) ;
85
+ var TestWebService = proxyquire ( '../../lib/services/web' , {
86
+ http : {
87
+ createServer : sinon . stub ( )
88
+ } ,
89
+ https : {
90
+ createServer : sinon . stub ( )
91
+ } ,
92
+ fs : fsStub ,
93
+ express : sinon . stub ( ) . returns ( {
94
+ use : sinon . stub ( )
95
+ } ) ,
96
+ 'body-parser' : {
97
+ json : jsonStub
98
+ } ,
99
+ 'socket.io' : {
100
+ listen : sinon . stub ( ) . returns ( {
101
+ on : sinon . stub ( )
102
+ } )
103
+ }
104
+ } ) ;
105
+ var web = new TestWebService ( { node : node } ) ;
106
+ web . start ( function ( err ) {
107
+ if ( err ) {
108
+ return done ( err ) ;
109
+ }
110
+ jsonStub . callCount . should . equal ( 1 ) ;
111
+ jsonStub . args [ 0 ] [ 0 ] . limit . should . equal ( '100kb' ) ;
112
+ done ( ) ;
113
+ } ) ;
114
+ } ) ;
78
115
} ) ;
79
116
80
117
describe ( '#stop' , function ( ) {
0 commit comments