mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-06 10:52:31 +01:00
Remove nulled properties from GET /channels/#id/messages
for improved compatibility with some client ( discord.js )
This commit is contained in:
parent
71d3e81b53
commit
1d86692af0
@ -126,6 +126,13 @@ router.get("/", async (req: Request, res: Response) => {
|
|||||||
y.proxy_url = `${endpoint == null ? "" : endpoint}${new URL(uri).pathname}`;
|
y.proxy_url = `${endpoint == null ? "" : endpoint}${new URL(uri).pathname}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Some clients ( discord.js ) only check if a property exists within the response,
|
||||||
|
//which causes erorrs when, say, the `application` property is `null`.
|
||||||
|
for (var curr in x) {
|
||||||
|
if (x[curr] === null)
|
||||||
|
delete x[curr];
|
||||||
|
}
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user