initial commit. phase 1 complete

This commit is contained in:
2026-05-05 20:45:19 +02:00
parent d9c68313a0
commit 89e058ffac
20631 changed files with 3224610 additions and 43 deletions
@@ -0,0 +1,31 @@
import { ACTION } from "../../client/components/app-router-headers";
export function getServerActionRequestMetadata(req) {
let actionId;
let contentType;
if (req.headers instanceof Headers) {
actionId = req.headers.get(ACTION.toLowerCase()) ?? null;
contentType = req.headers.get("content-type");
} else {
actionId = req.headers[ACTION.toLowerCase()] ?? null;
contentType = req.headers["content-type"] ?? null;
}
// We don't actually support URL encoded actions, and the action handler will bail out if it sees one.
// But we still want it to flow through to the action handler, to prevent changes in behavior when a regular
// page component tries to handle a POST.
const isURLEncodedAction = Boolean(req.method === "POST" && contentType === "application/x-www-form-urlencoded");
const isMultipartAction = Boolean(req.method === "POST" && (contentType == null ? void 0 : contentType.startsWith("multipart/form-data")));
const isFetchAction = Boolean(actionId !== undefined && typeof actionId === "string" && req.method === "POST");
const isServerAction = Boolean(isFetchAction || isURLEncodedAction || isMultipartAction);
return {
actionId,
isURLEncodedAction,
isMultipartAction,
isFetchAction,
isServerAction
};
}
export function getIsServerAction(req) {
return getServerActionRequestMetadata(req).isServerAction;
}
//# sourceMappingURL=server-action-request-meta.js.map