|  | @@ -2,7 +2,7 @@
 | 
												
													
														
															|  |  import child_process from 'child_process';
 |  |  import child_process from 'child_process';
 | 
												
													
														
															|  |  import tape from 'tape';
 |  |  import tape from 'tape';
 | 
												
													
														
															|  |  import _test from 'tape-promise';
 |  |  import _test from 'tape-promise';
 | 
												
													
														
															|  | -import http from 'http';
 |  | 
 | 
												
													
														
															|  | 
 |  | +import fetch from 'isomorphic-fetch';
 | 
												
													
														
															|  |  import socketclient from 'socket.io-client';
 |  |  import socketclient from 'socket.io-client';
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  const tapetest = _test(tape);
 |  |  const tapetest = _test(tape);
 | 
												
											
												
													
														
															|  | @@ -16,7 +16,8 @@ tapetest('test server', async function testServer(assert) {
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |      try {
 |  |      try {
 | 
												
													
														
															|  |          await waitPro();
 |  |          await waitPro();
 | 
												
													
														
															|  | -        const data = await requestPro(`http://${serverhost}:${serverport}`);
 |  | 
 | 
												
													
														
															|  | 
 |  | +        const ret = await fetch(`http://${serverhost}:${serverport}`),
 | 
												
													
														
															|  | 
 |  | +            data = await ret.text();
 | 
												
													
														
															|  |          assert.equal(data, 'working', 'received message from server');
 |  |          assert.equal(data, 'working', 'received message from server');
 | 
												
													
														
															|  |      }
 |  |      }
 | 
												
													
														
															|  |      catch(e) {
 |  |      catch(e) {
 | 
												
											
												
													
														
															|  | @@ -38,36 +39,6 @@ function waitPro(n = 1000) {
 | 
												
													
														
															|  |          setTimeout(resolve, n);
 |  |          setTimeout(resolve, n);
 | 
												
													
														
															|  |      });
 |  |      });
 | 
												
													
														
															|  |  }
 |  |  }
 | 
												
													
														
															|  | -function requestPro(reqopts, data) {
 |  | 
 | 
												
													
														
															|  | -    return new Promise(function prot(resolve, reject) {
 |  | 
 | 
												
													
														
															|  | -        try {
 |  | 
 | 
												
													
														
															|  | -            let req = http.request(reqopts, function received(resp) {
 |  | 
 | 
												
													
														
															|  | -                let str = '';
 |  | 
 | 
												
													
														
															|  | -                resp.on('data', function p(part) {
 |  | 
 | 
												
													
														
															|  | -                    str += part;
 |  | 
 | 
												
													
														
															|  | -                });
 |  | 
 | 
												
													
														
															|  | -                resp.on('end', function done() {
 |  | 
 | 
												
													
														
															|  | -                    if( resp.statusCode >= 400 && resp.statusCode <= 599 ) {
 |  | 
 | 
												
													
														
															|  | -                        reject(str);
 |  | 
 | 
												
													
														
															|  | -                    }
 |  | 
 | 
												
													
														
															|  | -                    else {
 |  | 
 | 
												
													
														
															|  | -                        resolve(str);
 |  | 
 | 
												
													
														
															|  | -                    }
 |  | 
 | 
												
													
														
															|  | -                });
 |  | 
 | 
												
													
														
															|  | -            });
 |  | 
 | 
												
													
														
															|  | -            req.on('error', function err(ee) {
 |  | 
 | 
												
													
														
															|  | -                reject(ee);
 |  | 
 | 
												
													
														
															|  | -            });
 |  | 
 | 
												
													
														
															|  | -            if( data ) {
 |  | 
 | 
												
													
														
															|  | -                req.write(data);
 |  | 
 | 
												
													
														
															|  | -            }
 |  | 
 | 
												
													
														
															|  | -            req.end();
 |  | 
 | 
												
													
														
															|  | -        }
 |  | 
 | 
												
													
														
															|  | -        catch(e) {
 |  | 
 | 
												
													
														
															|  | -            reject(e);
 |  | 
 | 
												
													
														
															|  | -        }
 |  | 
 | 
												
													
														
															|  | -    });
 |  | 
 | 
												
													
														
															|  | -}
 |  | 
 | 
												
													
														
															|  |  function responsePro(socket, evt, wait = 3000) {
 |  |  function responsePro(socket, evt, wait = 3000) {
 | 
												
													
														
															|  |      return new Promise(function pro(resolve, reject) {
 |  |      return new Promise(function pro(resolve, reject) {
 | 
												
													
														
															|  |          let to = setTimeout(reject.bind(null, 'socket event TIMEOUT ' + evt), wait);
 |  |          let to = setTimeout(reject.bind(null, 'socket event TIMEOUT ' + evt), wait);
 |