UNPKG

astro

Version:

Astro is a modern site builder with web best practices, performance, and DX front-of-mind.

17 lines (16 loc) 534 B
const ACTION_API_CONTEXT_SYMBOL = Symbol.for("astro.actionAPIContext"); const formContentTypes = ["application/x-www-form-urlencoded", "multipart/form-data"]; function hasContentType(contentType, expected) { const type = contentType.split(";")[0].toLowerCase(); return expected.some((t) => type === t); } function isActionAPIContext(ctx) { const symbol = Reflect.get(ctx, ACTION_API_CONTEXT_SYMBOL); return symbol === true; } export { ACTION_API_CONTEXT_SYMBOL, formContentTypes, hasContentType, isActionAPIContext };