@@ -69,8 +69,8 @@ describe("browser", () => {
69
69
it ( "should throw error with 'Unknown api request.'" , function ( done ) {
70
70
71
71
WebSocketAPI . fetch ( "something404" , undefined , {
72
- use : "ws"
73
- } )
72
+ use : "ws"
73
+ } )
74
74
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
75
75
. catch ( err => {
76
76
try {
@@ -88,8 +88,8 @@ describe("browser", () => {
88
88
it ( "should throw error with 'test error'" , function ( done ) {
89
89
90
90
WebSocketAPI . fetch ( "error" , undefined , {
91
- use : "ws"
92
- } )
91
+ use : "ws"
92
+ } )
93
93
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
94
94
. catch ( err => {
95
95
try {
@@ -107,9 +107,9 @@ describe("browser", () => {
107
107
it ( "should throw timeout error with 'Timeout Error'" , function ( done ) {
108
108
109
109
WebSocketAPI . fetch ( "timeout" , undefined , {
110
- use : "ws" ,
111
- timeout : 150
112
- } )
110
+ use : "ws" ,
111
+ timeout : 150
112
+ } )
113
113
. then ( _ => done ( new Error ( "Was supposed to throw a timeout error." ) ) )
114
114
. catch ( err => {
115
115
try {
@@ -148,8 +148,8 @@ describe("browser", () => {
148
148
it ( "should throw error with 'Unknown api request.'" , function ( done ) {
149
149
150
150
WebSocketAPI . fetch ( "something404" , undefined , {
151
- use : "http"
152
- } )
151
+ use : "http"
152
+ } )
153
153
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
154
154
. catch ( err => {
155
155
try {
@@ -167,8 +167,8 @@ describe("browser", () => {
167
167
it ( "should throw error with 'test error'" , function ( done ) {
168
168
169
169
WebSocketAPI . fetch ( "error" , undefined , {
170
- use : "http"
171
- } )
170
+ use : "http"
171
+ } )
172
172
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
173
173
. catch ( err => {
174
174
try {
@@ -186,9 +186,9 @@ describe("browser", () => {
186
186
it ( "should throw timeout error with 'Timeout Error'" , function ( done ) {
187
187
188
188
WebSocketAPI . fetch ( "timeout" , undefined , {
189
- use : "http" ,
190
- timeout : 150
191
- } )
189
+ use : "http" ,
190
+ timeout : 150
191
+ } )
192
192
. then ( _ => done ( new Error ( "Was supposed to throw a timeout error." ) ) )
193
193
. catch ( err => {
194
194
try {
@@ -203,6 +203,31 @@ describe("browser", () => {
203
203
this . timeout ( 200 ) ;
204
204
} ) ;
205
205
206
+ // the get request's body should be readable from server and returned as a echo
207
+ it ( "Echo with the request body" , async function ( ) {
208
+ this . timeout ( 200 ) ;
209
+ const response = await WebSocketAPI . fetch ( "echo" , {
210
+ a : 56 ,
211
+ b : "c" ,
212
+ d : null ,
213
+ nested : {
214
+ a : 10
215
+ }
216
+ } , {
217
+ use : "http" ,
218
+ timeout : 150
219
+ } ) ;
220
+
221
+ // check that the response is equal
222
+ assert . deepEqual ( response , {
223
+ a : 56 ,
224
+ b : "c" ,
225
+ d : null ,
226
+ nested : {
227
+ a : 10
228
+ }
229
+ } ) ;
230
+ } ) ;
206
231
} ) ;
207
232
208
233
} ) ;
@@ -238,9 +263,9 @@ describe("browser", () => {
238
263
it ( "should throw error with 'Unknown api request.'" , function ( done ) {
239
264
240
265
WebSocketAPI . fetch ( "something404" , undefined , {
241
- use : "ws" ,
242
- method : "POST" ,
243
- } )
266
+ use : "ws" ,
267
+ method : "POST" ,
268
+ } )
244
269
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
245
270
. catch ( err => {
246
271
try {
@@ -258,9 +283,9 @@ describe("browser", () => {
258
283
it ( "should throw error with 'test error'" , function ( done ) {
259
284
260
285
WebSocketAPI . fetch ( "error" , postData , {
261
- use : "ws" ,
262
- method : "POST" ,
263
- } )
286
+ use : "ws" ,
287
+ method : "POST" ,
288
+ } )
264
289
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
265
290
. catch ( err => {
266
291
try {
@@ -278,10 +303,10 @@ describe("browser", () => {
278
303
it ( "should throw timeout error with 'Timeout Error'" , function ( done ) {
279
304
280
305
WebSocketAPI . fetch ( "timeout" , postData , {
281
- use : "ws" ,
282
- timeout : 150 ,
283
- method : "POST" ,
284
- } )
306
+ use : "ws" ,
307
+ timeout : 150 ,
308
+ method : "POST" ,
309
+ } )
285
310
. then ( _ => done ( new Error ( "Was supposed to throw a timeout error." ) ) )
286
311
. catch ( err => {
287
312
try {
@@ -315,9 +340,9 @@ describe("browser", () => {
315
340
it ( "should throw error with 'Unknown api request.'" , function ( done ) {
316
341
317
342
WebSocketAPI . fetch ( "something404" , postData , {
318
- use : "http" ,
319
- method : "POST" ,
320
- } )
343
+ use : "http" ,
344
+ method : "POST" ,
345
+ } )
321
346
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
322
347
. catch ( err => {
323
348
try {
@@ -335,9 +360,9 @@ describe("browser", () => {
335
360
it ( "should throw error with 'test error'" , function ( done ) {
336
361
337
362
WebSocketAPI . fetch ( "error" , postData , {
338
- use : "http" ,
339
- method : "POST" ,
340
- } )
363
+ use : "http" ,
364
+ method : "POST" ,
365
+ } )
341
366
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
342
367
. catch ( err => {
343
368
try {
@@ -355,10 +380,10 @@ describe("browser", () => {
355
380
it ( "should throw timeout error with 'Timeout Error'" , function ( done ) {
356
381
357
382
WebSocketAPI . fetch ( "timeout" , postData , {
358
- use : "http" ,
359
- timeout : 150 ,
360
- method : "POST" ,
361
- } )
383
+ use : "http" ,
384
+ timeout : 150 ,
385
+ method : "POST" ,
386
+ } )
362
387
. then ( _ => done ( new Error ( "Was supposed to throw a timeout error." ) ) )
363
388
. catch ( err => {
364
389
try {
@@ -408,9 +433,9 @@ describe("browser", () => {
408
433
it ( "should throw error with 'Unknown api request.'" , function ( done ) {
409
434
410
435
WebSocketAPI . fetch ( "something404" , undefined , {
411
- use : "ws" ,
412
- method : "PUT" ,
413
- } )
436
+ use : "ws" ,
437
+ method : "PUT" ,
438
+ } )
414
439
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
415
440
. catch ( err => {
416
441
try {
@@ -428,9 +453,9 @@ describe("browser", () => {
428
453
it ( "should throw error with 'test error'" , function ( done ) {
429
454
430
455
WebSocketAPI . fetch ( "error" , postData , {
431
- use : "ws" ,
432
- method : "PUT" ,
433
- } )
456
+ use : "ws" ,
457
+ method : "PUT" ,
458
+ } )
434
459
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
435
460
. catch ( err => {
436
461
try {
@@ -448,10 +473,10 @@ describe("browser", () => {
448
473
it ( "should throw timeout error with 'Timeout Error'" , function ( done ) {
449
474
450
475
WebSocketAPI . fetch ( "timeout" , postData , {
451
- use : "ws" ,
452
- timeout : 150 ,
453
- method : "PUT" ,
454
- } )
476
+ use : "ws" ,
477
+ timeout : 150 ,
478
+ method : "PUT" ,
479
+ } )
455
480
. then ( _ => done ( new Error ( "Was supposed to throw a timeout error." ) ) )
456
481
. catch ( err => {
457
482
try {
@@ -485,9 +510,9 @@ describe("browser", () => {
485
510
it ( "should throw error with 'Unknown api request.'" , function ( done ) {
486
511
487
512
WebSocketAPI . fetch ( "something404" , postData , {
488
- use : "http" ,
489
- method : "PUT" ,
490
- } )
513
+ use : "http" ,
514
+ method : "PUT" ,
515
+ } )
491
516
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
492
517
. catch ( err => {
493
518
try {
@@ -505,9 +530,9 @@ describe("browser", () => {
505
530
it ( "should throw error with 'test error'" , function ( done ) {
506
531
507
532
WebSocketAPI . fetch ( "error" , postData , {
508
- use : "http" ,
509
- method : "PUT" ,
510
- } )
533
+ use : "http" ,
534
+ method : "PUT" ,
535
+ } )
511
536
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
512
537
. catch ( err => {
513
538
try {
@@ -525,10 +550,10 @@ describe("browser", () => {
525
550
it ( "should throw timeout error with 'Timeout Error'" , function ( done ) {
526
551
527
552
WebSocketAPI . fetch ( "timeout" , postData , {
528
- use : "http" ,
529
- timeout : 150 ,
530
- method : "PUT" ,
531
- } )
553
+ use : "http" ,
554
+ timeout : 150 ,
555
+ method : "PUT" ,
556
+ } )
532
557
. then ( _ => done ( new Error ( "Was supposed to throw a timeout error." ) ) )
533
558
. catch ( err => {
534
559
try {
@@ -571,8 +596,8 @@ describe("browser", () => {
571
596
it ( "should throw error with 'Unknown api request.'" , function ( done ) {
572
597
573
598
WebSocketAPI . fetch ( "something404" , undefined , {
574
- use : "ws"
575
- } )
599
+ use : "ws"
600
+ } )
576
601
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
577
602
. catch ( err => {
578
603
try {
@@ -590,9 +615,9 @@ describe("browser", () => {
590
615
it ( "should throw error with 'test error'" , function ( done ) {
591
616
592
617
WebSocketAPI . fetch ( "error" , undefined , {
593
- use : "ws" ,
594
- method : "DELETE"
595
- } )
618
+ use : "ws" ,
619
+ method : "DELETE"
620
+ } )
596
621
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
597
622
. catch ( err => {
598
623
try {
@@ -610,10 +635,10 @@ describe("browser", () => {
610
635
it ( "should throw timeout error with 'Timeout Error'" , function ( done ) {
611
636
612
637
WebSocketAPI . fetch ( "timeout" , undefined , {
613
- use : "ws" ,
614
- timeout : 150 ,
615
- method : "DELETE"
616
- } )
638
+ use : "ws" ,
639
+ timeout : 150 ,
640
+ method : "DELETE"
641
+ } )
617
642
. then ( _ => done ( new Error ( "Was supposed to throw a timeout error." ) ) )
618
643
. catch ( err => {
619
644
try {
@@ -649,9 +674,9 @@ describe("browser", () => {
649
674
it ( "should throw error with 'Unknown api request.'" , function ( done ) {
650
675
651
676
WebSocketAPI . fetch ( "something404" , undefined , {
652
- use : "http" ,
653
- method : "DELETE"
654
- } )
677
+ use : "http" ,
678
+ method : "DELETE"
679
+ } )
655
680
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
656
681
. catch ( err => {
657
682
try {
@@ -669,9 +694,9 @@ describe("browser", () => {
669
694
it ( "should throw error with 'test error'" , function ( done ) {
670
695
671
696
WebSocketAPI . fetch ( "error" , undefined , {
672
- use : "http" ,
673
- method : "DELETE"
674
- } )
697
+ use : "http" ,
698
+ method : "DELETE"
699
+ } )
675
700
. then ( _ => done ( new Error ( "Was supposed to throw a error." ) ) )
676
701
. catch ( err => {
677
702
try {
@@ -689,10 +714,10 @@ describe("browser", () => {
689
714
it ( "should throw timeout error with 'Timeout Error'" , function ( done ) {
690
715
691
716
WebSocketAPI . fetch ( "timeout" , undefined , {
692
- use : "http" ,
693
- timeout : 150 ,
694
- method : "DELETE"
695
- } )
717
+ use : "http" ,
718
+ timeout : 150 ,
719
+ method : "DELETE"
720
+ } )
696
721
. then ( _ => done ( new Error ( "Was supposed to throw a timeout error." ) ) )
697
722
. catch ( err => {
698
723
try {
0 commit comments