修复 text/plain 通知消息替换

This commit is contained in:
whyour 2024-04-16 10:48:33 +08:00
parent 2e7f3a1578
commit 510534ee0c
3 changed files with 3 additions and 3 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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)