@aimeloic/monkey-tester 4.0.2 → 4.0.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/monkey.js +19 -15
- package/package.json +1 -1
package/monkey.js
CHANGED
|
@@ -101,21 +101,25 @@ function parseStack(stack, detectedEndpoints, prefix = '') {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
let bodyFields = [];
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
104
|
+
// Inside your parseStack function in monkey.js, update this block:
|
|
105
|
+
if (['POST', 'PUT', 'PATCH'].includes(httpMethod)) {
|
|
106
|
+
const handlers = (layer.route.stack || []).map(sl => sl.handle).filter(Boolean);
|
|
107
|
+
for (const handler of handlers) {
|
|
108
|
+
bodyFields.push(...extractBodyFields(handler));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const seen = new Map();
|
|
112
|
+
bodyFields = bodyFields.filter(f => {
|
|
113
|
+
if (seen.has(f.name)) return false;
|
|
114
|
+
seen.set(f.name, true);
|
|
115
|
+
return true;
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// CHANGE THIS: Only apply generic fallbacks if there are no explicit path parameters
|
|
119
|
+
if (bodyFields.length === 0 && pathParams.length === 0) {
|
|
120
|
+
bodyFields = fallbackFields(fullPath);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
119
123
|
|
|
120
124
|
detectedEndpoints[key] = {
|
|
121
125
|
method: httpMethod,
|