@replayio-app-building/netlify-recorder 0.36.0 → 0.37.0
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/dist/index.js +18 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1032,6 +1032,24 @@ async function createRequestRecording(blobUrlOrData, handlerPath, requestInfo) {
|
|
|
1032
1032
|
handler = handlerModule;
|
|
1033
1033
|
isV2 = true;
|
|
1034
1034
|
}
|
|
1035
|
+
if (!handler && requestInfo.method) {
|
|
1036
|
+
const httpMethodNames = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"];
|
|
1037
|
+
let target = handlerModule;
|
|
1038
|
+
for (let depth = 0; depth < 6 && target && typeof target === "object"; depth++) {
|
|
1039
|
+
const obj = target;
|
|
1040
|
+
const method = requestInfo.method.toUpperCase();
|
|
1041
|
+
if (httpMethodNames.includes(method) && typeof obj[method] === "function") {
|
|
1042
|
+
handler = obj[method];
|
|
1043
|
+
isV2 = true;
|
|
1044
|
+
break;
|
|
1045
|
+
}
|
|
1046
|
+
if (obj.default && typeof obj.default === "object") {
|
|
1047
|
+
target = obj.default;
|
|
1048
|
+
continue;
|
|
1049
|
+
}
|
|
1050
|
+
break;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1035
1053
|
if (!handler) {
|
|
1036
1054
|
throw new Error(
|
|
1037
1055
|
`Could not resolve handler from ${handlerPath}. Module exports: [${Object.keys(handlerModule).join(", ")}]`
|