diff --git a/back/config/util.ts b/back/config/util.ts index 318aa041..77fef6bc 100644 --- a/back/config/util.ts +++ b/back/config/util.ts @@ -399,7 +399,7 @@ export function parseBody( valueFormatFn?: (v: string) => string, ) { if (contentType === 'text/plain' || !body) { - return body; + return valueFormatFn && body ? valueFormatFn(body) : body; } const parsed = parseString(body, valueFormatFn); diff --git a/sample/notify.js b/sample/notify.js index 9d17e16a..9351cefe 100644 --- a/sample/notify.js +++ b/sample/notify.js @@ -1379,7 +1379,7 @@ function parseHeaders(headers) { function parseBody(body, contentType, valueFormatFn) { if (contentType === 'text/plain' || !body) { - return body; + return valueFormatFn && body ? valueFormatFn(body) : body; } const parsed = parseString(body, valueFormatFn); diff --git a/sample/notify.py b/sample/notify.py index 2bd0f7ae..0e40fcbc 100644 --- a/sample/notify.py +++ b/sample/notify.py @@ -766,7 +766,7 @@ def parse_string(input_string, value_format_fn=None): def parse_body(body, content_type, value_format_fn=None): if not body or content_type == "text/plain": - return body + return value_format_fn(body) if value_format_fn and body else body parsed = parse_string(body, value_format_fn)