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,6 +95,7 @@ export class LogManager {
|
|||
const content_type = req.headers.get("Content-Type");
|
||||
|
||||
if (content_type?.includes("application/json")) {
|
||||
try {
|
||||
const json = await req.json();
|
||||
const stringified = JSON.stringify(json, null, 4)
|
||||
.split("\n")
|
||||
|
|
@ -102,6 +103,9 @@ export class LogManager {
|
|||
.join("\n");
|
||||
|
||||
string += `${stringified}\n`;
|
||||
} catch {
|
||||
string += " [Invalid JSON]\n";
|
||||
}
|
||||
} else if (
|
||||
content_type &&
|
||||
(content_type.includes("application/x-www-form-urlencoded") ||
|
||||
|
|
|
|||
Loading…
Reference in a new issue