fiftyone.pipeline.cloudrequestengine 4.4.48 → 4.4.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiftyone.pipeline.cloudrequestengine",
3
- "version": "4.4.48",
3
+ "version": "4.4.49",
4
4
  "description": "Cloud request engine for the 51Degrees Pipeline API",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -32,25 +32,33 @@ require('module').Module._initPaths();
32
32
 
33
33
  const noCheck = function () {};
34
34
 
35
+ let GET_PORT = 3000;
36
+ let POST_PORT = 4000;
37
+
35
38
  let server;
36
39
 
37
40
  afterEach(() => { // eslint-disable-line
38
41
  if (server) {
42
+ GET_PORT++;
43
+ POST_PORT++;
39
44
  server.close();
40
45
  server = undefined;
41
46
  }
42
47
  });
43
48
 
49
+ beforeEach(() => { // eslint-disable-line
50
+ if (!server) server = http.createServer();
51
+ });
52
+
44
53
  const getTest = function (origin, writeResponse, checkRequest, checkResponse, done) {
45
54
  const client = new RequestClient();
46
55
  const requestListener = function (req, res) {
47
56
  checkRequest(req);
48
57
  writeResponse(res);
49
58
  };
50
-
51
- server = http.createServer(requestListener);
52
- server.listen(3000, () => {
53
- const response = client.get('http://localhost:3000', origin);
59
+ server.addListener('request', requestListener);
60
+ server.listen(GET_PORT, () => {
61
+ const response = client.get(`http://localhost:${GET_PORT}`, origin);
54
62
  checkResponse(response)
55
63
  .finally(() => {
56
64
  done();
@@ -65,9 +73,9 @@ const postTest = function (data, origin, writeResponse, checkRequest, checkRespo
65
73
  writeResponse(res);
66
74
  };
67
75
 
68
- server = http.createServer(requestListener);
69
- server.listen(3000, () => {
70
- const response = client.post('http://localhost:3000', data, origin);
76
+ server.addListener('request', requestListener);
77
+ server.listen(POST_PORT, () => {
78
+ const response = client.post(`http://localhost:${POST_PORT}`, data, origin);
71
79
  checkResponse(response)
72
80
  .finally(() => {
73
81
  done();