#Can I not fetch from an API that returns an array and make it JSON?
18 messages · Page 1 of 1 (latest)
well, then you are doing something wrong
yeah figured that much out
because that is valid JSON
seeing that you include no code i'm not too sure what else you expect as an answer
oh yeah right one sec
i removed everything else so this is the only code ```ts
const r = await ((await request('https://www.reddit.com/r/dankmemes/random.json')).body).json()
console.log(r)
doesn't log anything bc the error throws before that
the link isn't wrong either thats why im so confused
you need to allow unici to follow redirects. https://reddit.com/r/dankmemes/random.json redirects you to a random post, but unici doesnt follow redirects by default
OH
thank you
how do i do that
😭 sorry
request("...", { maxRedirections: 1 }) should be ok
ty
maybe you need more than 1, gotta test it
i mean it only redirects once right