aboutsummaryrefslogtreecommitdiff
path: root/174bg/discord-bot/utilities
diff options
context:
space:
mode:
authorAlex Pooley (@zuedev) <zuedev@gmail.com>2026-07-21 17:01:54 +0100
committerAlex Pooley (@zuedev) <zuedev@gmail.com>2026-07-21 17:01:54 +0100
commit764f90577eeadd653f3f6248fbf2b0918c97a3d5 (patch)
tree84ca4a80cf0d230e0484bac40801e194691169bc /174bg/discord-bot/utilities
parent55e8a329ce0cbb29c0f41c6c4c0187230975a011 (diff)
downloadunnamed-group-764f90577eeadd653f3f6248fbf2b0918c97a3d5.tar
unnamed-group-764f90577eeadd653f3f6248fbf2b0918c97a3d5.tar.gz
unnamed-group-764f90577eeadd653f3f6248fbf2b0918c97a3d5.tar.bz2
unnamed-group-764f90577eeadd653f3f6248fbf2b0918c97a3d5.tar.xz
unnamed-group-764f90577eeadd653f3f6248fbf2b0918c97a3d5.zip
fix oncall w/ pocketbase controller
Diffstat (limited to '174bg/discord-bot/utilities')
-rw-r--r--174bg/discord-bot/utilities/getUrl.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/174bg/discord-bot/utilities/getUrl.js b/174bg/discord-bot/utilities/getUrl.js
index 49342d9..a6e22ef 100644
--- a/174bg/discord-bot/utilities/getUrl.js
+++ b/174bg/discord-bot/utilities/getUrl.js
@@ -1,5 +1,14 @@
export default async (url) => {
const response = await fetch(url);
+
if (!response.ok) return null;
- return await response.json();
+
+ // is it json?
+ const contentType = response.headers.get("content-type");
+ if (contentType && contentType.includes("application/json")) {
+ return await response.json();
+ }
+
+ // fallback to text
+ return await response.text();
};