makiwara 2.1.1 → 2.1.3
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/README.md +4 -4
- package/package.json +11 -12
- package/src/display.js +2 -2
- package/src/local-fetch.js +3 -3
- package/src/make-requests.js +2 -2
- package/src/object-util.js +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# makiwara
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/makiwara)
|
|
3
4
|
[](https://badge.fury.io/js/makiwara)
|
|
4
|
-
[](https://www.npmjs.com
|
|
5
|
-
[](https://coveralls.io/github/piecioshka/makiwara?branch=master)
|
|
5
|
+
[](https://www.npmjs.com/package/makiwara)
|
|
6
|
+
[](https://www.npmjs.com/package/makiwara)
|
|
7
|
+
[](https://app.travis-ci.com/github/piecioshka/makiwara)
|
|
8
8
|
|
|
9
9
|
:hammer: Benchmark URL to gain HTTP requests limits
|
|
10
10
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "makiwara",
|
|
3
3
|
"description": "Benchmark URL to gain HTTP requests limits",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Piotr Kowalski",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"clear": "rm -rf dist/ coverage/ .nyc_output/",
|
|
13
13
|
"clear:all": "rm -rf node_modules/ && npm run clear",
|
|
14
14
|
"test": "jasmine test/specs/*.js",
|
|
15
|
-
"coverage": "nyc npm run test && nyc report --reporter=
|
|
16
|
-
"lint": "eslint
|
|
15
|
+
"coverage": "nyc npm run test && nyc report --reporter=html",
|
|
16
|
+
"lint": "eslint src/",
|
|
17
17
|
"snyk-protect": "snyk protect",
|
|
18
18
|
"prepare": "npm run snyk-protect"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@types/node": "^17.0.
|
|
21
|
+
"@types/node": "^17.0.8",
|
|
22
22
|
"ansi-bold": "^0.1.1",
|
|
23
23
|
"ansi-cyan": "^0.1.1",
|
|
24
24
|
"ansi-gray": "^0.1.1",
|
|
@@ -26,20 +26,19 @@
|
|
|
26
26
|
"ansi-yellow": "^0.1.1",
|
|
27
27
|
"axios": "^0.24.0",
|
|
28
28
|
"commander": "^8.3.0",
|
|
29
|
-
"http-status-codes": "^2.
|
|
29
|
+
"http-status-codes": "^2.2.0",
|
|
30
30
|
"is-url": "^1.2.4",
|
|
31
31
|
"node-fetch": "^3.1.0",
|
|
32
32
|
"ora": "^6.0.1",
|
|
33
|
-
"snyk": "^1.
|
|
34
|
-
"table": "^6.
|
|
33
|
+
"snyk": "^1.826.0",
|
|
34
|
+
"table": "^6.8.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/jasmine": "^3.10.
|
|
38
|
-
"
|
|
39
|
-
"eslint": "^8.5.0",
|
|
37
|
+
"@types/jasmine": "^3.10.3",
|
|
38
|
+
"eslint": "^8.6.0",
|
|
40
39
|
"eslint-config-piecioshka": "^2.0.4",
|
|
41
|
-
"jasmine": "^
|
|
42
|
-
"nock": "^13.2.
|
|
40
|
+
"jasmine": "^4.0.2",
|
|
41
|
+
"nock": "^13.2.2",
|
|
43
42
|
"nyc": "^15.1.0"
|
|
44
43
|
},
|
|
45
44
|
"repository": {
|
package/src/display.js
CHANGED
|
@@ -14,7 +14,7 @@ const tableOptions = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
function appendHttpStatusCodeLabel(statusCodeEntries) {
|
|
17
|
-
statusCodeEntries.forEach(
|
|
17
|
+
statusCodeEntries.forEach(entry => {
|
|
18
18
|
let label = null;
|
|
19
19
|
try {
|
|
20
20
|
label = HTTPStatusCodes.getStatusText(entry[0]);
|
|
@@ -29,7 +29,7 @@ function appendHttpStatusCodeLabel(statusCodeEntries) {
|
|
|
29
29
|
|
|
30
30
|
function displayRequestsSummary(attackResults) {
|
|
31
31
|
const statusCodes = collapseArray(
|
|
32
|
-
attackResults.requests.map(
|
|
32
|
+
attackResults.requests.map(r => r.status)
|
|
33
33
|
);
|
|
34
34
|
const isEmptyResults = (statusCodes.length === 0);
|
|
35
35
|
|
package/src/local-fetch.js
CHANGED
|
@@ -17,11 +17,11 @@ async function makeRequest(url, options = {}) {
|
|
|
17
17
|
};
|
|
18
18
|
const protocol = getProtocol(url);
|
|
19
19
|
return new Promise((resolve, reject) => {
|
|
20
|
-
protocol.get(url, options,
|
|
21
|
-
res.addListener('data',
|
|
20
|
+
protocol.get(url, options, res => {
|
|
21
|
+
res.addListener('data', data => {
|
|
22
22
|
response.text += data.toString();
|
|
23
23
|
});
|
|
24
|
-
res.addListener('error',
|
|
24
|
+
res.addListener('error', err => {
|
|
25
25
|
reject(err);
|
|
26
26
|
});
|
|
27
27
|
res.addListener('end', () => {
|
package/src/make-requests.js
CHANGED
|
@@ -6,7 +6,7 @@ const makeRequest = require('./local-fetch');
|
|
|
6
6
|
const SECOND_IN_MILLISECONDS = 1000;
|
|
7
7
|
|
|
8
8
|
function pause(timeoutInSeconds) {
|
|
9
|
-
return new Promise(
|
|
9
|
+
return new Promise(resolve => {
|
|
10
10
|
setTimeout(resolve, timeoutInSeconds * SECOND_IN_MILLISECONDS);
|
|
11
11
|
});
|
|
12
12
|
}
|
|
@@ -45,7 +45,7 @@ async function makeRequestsInConcurrentMode(url, durationInSeconds) {
|
|
|
45
45
|
status(i);
|
|
46
46
|
|
|
47
47
|
await makeRequest(url, { agent: false })
|
|
48
|
-
.then(
|
|
48
|
+
.then(response => {
|
|
49
49
|
requests.push(response);
|
|
50
50
|
});
|
|
51
51
|
}
|