Replace fetch with got

This commit is contained in:
Ethan Lane 2021-12-01 20:39:02 +00:00
parent f673339d90
commit d32b44052c
Signed by: Vylpes
GPG key ID: EED233CC06D12504
4 changed files with 190 additions and 38 deletions

View file

@ -1,6 +1,6 @@
import IFetchResult from "./contracts/IFetchResult";
import IRedditResult from "./contracts/IRedditResult";
import fetch from "node-fetch";
import fetch from "got";
const sortable = [
'new',
@ -19,7 +19,7 @@ export default async function randomBunny(subreddit: string, sortBy: string, max
}
}
const json = await result.json() as any;
const json = JSON.parse(result.body);
if (!json) {
return {