mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
Fix JSON parse error with Megalodon
This commit is contained in:
parent
26596bb987
commit
1115b72ca6
|
|
@ -95,13 +95,17 @@ export class LogManager {
|
||||||
const content_type = req.headers.get("Content-Type");
|
const content_type = req.headers.get("Content-Type");
|
||||||
|
|
||||||
if (content_type?.includes("application/json")) {
|
if (content_type?.includes("application/json")) {
|
||||||
const json = await req.json();
|
try {
|
||||||
const stringified = JSON.stringify(json, null, 4)
|
const json = await req.json();
|
||||||
.split("\n")
|
const stringified = JSON.stringify(json, null, 4)
|
||||||
.map((line) => ` ${line}`)
|
.split("\n")
|
||||||
.join("\n");
|
.map((line) => ` ${line}`)
|
||||||
|
.join("\n");
|
||||||
|
|
||||||
string += `${stringified}\n`;
|
string += `${stringified}\n`;
|
||||||
|
} catch {
|
||||||
|
string += " [Invalid JSON]\n";
|
||||||
|
}
|
||||||
} else if (
|
} else if (
|
||||||
content_type &&
|
content_type &&
|
||||||
(content_type.includes("application/x-www-form-urlencoded") ||
|
(content_type.includes("application/x-www-form-urlencoded") ||
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue