openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
28 lines (27 loc) • 998 B
JavaScript
import { E as parseStrictNonNegativeInteger } from "./number-coercion-D6u-4YD8.mjs";
import { o as emitInternalDiagnosticEvent } from "./diagnostic-events-BjAH1Kbx.mjs";
//#region src/logging/diagnostic-payload.ts
/** Emits a normalized diagnostic event for rejected, truncated, or chunked payloads. */
function logLargePayload(e) {
emitInternalDiagnosticEvent({
type: "payload.large",
...e
});
}
/** Convenience wrapper for payloads rejected before downstream processing. */
function logRejectedLargePayload(e) {
logLargePayload({
action: "rejected",
...e
});
}
/** Parses an HTTP Content-Length header without accepting malformed numeric input. */
function parseContentLengthHeader(e) {
const t = Array.isArray(e) ? e[0] : e;
if (typeof t !== "string") return;
const n = t.trim();
if (n.length === 0 || !/^\d+$/.test(n)) return;
return parseStrictNonNegativeInteger(n);
}
//#endregion
export { logRejectedLargePayload as n, parseContentLengthHeader as r, logLargePayload as t };