Replace fetch with got
This commit is contained in:
parent
f673339d90
commit
d32b44052c
4 changed files with 190 additions and 38 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue