aboutsummaryrefslogtreecommitdiff
path: root/174bg/discord-bot/controllers/http.js
diff options
context:
space:
mode:
authorAlex Pooley (@zuedev) <zuedev@gmail.com>2026-07-22 15:32:57 +0100
committerAlex Pooley (@zuedev) <zuedev@gmail.com>2026-07-22 15:32:57 +0100
commit72487019b3f255cece40a8073bbad8bc9968a3b7 (patch)
treeb6590e63039cdc8b1820bd345cdfe83f28ff839b /174bg/discord-bot/controllers/http.js
parentda0509c91376f56f133872eddd2e4282d76f215e (diff)
downloadunnamed-group-72487019b3f255cece40a8073bbad8bc9968a3b7.tar
unnamed-group-72487019b3f255cece40a8073bbad8bc9968a3b7.tar.gz
unnamed-group-72487019b3f255cece40a8073bbad8bc9968a3b7.tar.bz2
unnamed-group-72487019b3f255cece40a8073bbad8bc9968a3b7.tar.xz
unnamed-group-72487019b3f255cece40a8073bbad8bc9968a3b7.zip
major code refactor, add uex lookup
Diffstat (limited to '174bg/discord-bot/controllers/http.js')
-rw-r--r--174bg/discord-bot/controllers/http.js25
1 files changed, 0 insertions, 25 deletions
diff --git a/174bg/discord-bot/controllers/http.js b/174bg/discord-bot/controllers/http.js
deleted file mode 100644
index 816b73c..0000000
--- a/174bg/discord-bot/controllers/http.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Controller module for interacting with HTTP resources, mainly for fetching JSON data from external APIs.
- */
-
-/**
- * Fetches data from a specified URL and returns the response as JSON or text.
- * @param {string} url - The URL to fetch data from.
- * @returns {Promise<Object|string|null>} A Promise that resolves to the parsed JSON object, text, or null if the request fails.
- */
-export async function get(url) {
- const response = await fetch(url);
-
- if (!response.ok) return null;
-
- // 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();
-};
-
-return { get }; \ No newline at end of file