hatch-surf/node_modules/next/dist/esm/server/lib/server-action-request-meta.js
Riley Zhang df378d33ef
Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Merge GitHub main into Gitea repo (allow unrelated histories)
Resolved conflicts by taking GitHub versions for:
- .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml

Kept deploy.sh updated to:
- Pull from GitHub (primary source)
- Push to Gitea (push-mirror)
- Build from site/ directory (GitHub structure)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-06-25 05:20:46 +02:00

31 lines
1.5 KiB
JavaScript

import { ACTION_HEADER } from '../../client/components/app-router-headers';
export function getServerActionRequestMetadata(req) {
let actionId;
let contentType;
if (req.headers instanceof Headers) {
actionId = req.headers.get(ACTION_HEADER) ?? null;
contentType = req.headers.get('content-type');
} else {
actionId = req.headers[ACTION_HEADER] ?? 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 isPossibleServerAction = Boolean(isFetchAction || isURLEncodedAction || isMultipartAction);
return {
actionId,
isURLEncodedAction,
isMultipartAction,
isFetchAction,
isPossibleServerAction
};
}
export function getIsPossibleServerAction(req) {
return getServerActionRequestMetadata(req).isPossibleServerAction;
}
//# sourceMappingURL=server-action-request-meta.js.map