@aimeloic/monkey-tester 3.0.13 → 3.0.14
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/htmlTemplate.js +1 -1
- package/index.js +1 -3
- package/monkey.js +14 -5
- package/package.json +1 -1
package/htmlTemplate.js
CHANGED
package/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
|
|
2
3
|
import { endtesterExpress } from './monkey.js';
|
|
3
4
|
|
|
4
|
-
// Named export for: import { endtesterExpress } from '@aimeloic/monkey-tester'
|
|
5
5
|
export { endtesterExpress };
|
|
6
|
-
|
|
7
|
-
// Default export for: import monkeyTester from '@aimeloic/monkey-tester'
|
|
8
6
|
export default { endtesterExpress };
|
package/monkey.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { getHtmlTemplate } from './htmlTemplate.js';
|
|
4
4
|
|
|
5
5
|
function inferType(name) {
|
|
6
6
|
const n = name.toLowerCase();
|
|
@@ -133,7 +133,11 @@ function parseStack(stack, detectedEndpoints, prefix = '') {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
function endtesterExpress() {
|
|
136
|
+
// function endtesterExpress() { ... }
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
// Change it to this instead:
|
|
140
|
+
export function endtesterExpress() {
|
|
137
141
|
return function monkeyTesterMiddleware(req, res, next) {
|
|
138
142
|
if (req.path !== '/api/tester' && req.path !== '/api/tester/') {
|
|
139
143
|
return next();
|
|
@@ -142,13 +146,18 @@ function endtesterExpress() {
|
|
|
142
146
|
const app = req.app;
|
|
143
147
|
const detectedEndpoints = {};
|
|
144
148
|
|
|
145
|
-
const rootStack =
|
|
149
|
+
const rootStack =
|
|
150
|
+
(app._router && app._router.stack) ||
|
|
151
|
+
(app.router && app.router.stack) ||
|
|
152
|
+
[];
|
|
153
|
+
|
|
146
154
|
parseStack(rootStack, detectedEndpoints);
|
|
147
155
|
|
|
148
156
|
const html = getHtmlTemplate(detectedEndpoints);
|
|
149
|
-
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
157
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
150
158
|
return res.send(html);
|
|
151
159
|
};
|
|
152
160
|
}
|
|
153
161
|
|
|
154
|
-
exports = { endtesterExpress };
|
|
162
|
+
exports = { endtesterExpress };
|
|
163
|
+
module.exports = { endtesterExpress };
|