helperdiscord / petitio

An HTTP/S library designed to be simple, fast, and type-strong.
https://helperdiscord.github.io/petitio/
MIT License
44 stars 6 forks source link

SyntaxError Unexpected token u in JSON at position 0 #36

Closed pauldb09 closed 2 years ago

pauldb09 commented 2 years ago

image

Environment

Node v16

tbnritzdoge commented 2 years ago

It appears that you are attempting to parse JSON from a response that isn't JSON so this isn't a library issue.

sinkaroid commented 1 year ago

In my case basically the JSON was valid, but it's messy on some version of node. Broke on 16.17.0 but not in 16.16.0 when using petitio

dzlandis commented 1 year ago

In my case basically the JSON was valid, but it's messy on some version of node. Broke on 16.17.0 but not in 16.16.0 when using petitio

Experienced this same issue when trying to use petitio in Node version v16.18 when the JSON was valid. Was fixed by downgrading to v16.16.0 as the comment above mentions. Please fix and reopen this issue!

DJCoolDev commented 1 year ago

I can confirm this. A downgrade as mentioned above fixed the problem for me. However, it would be nice if it would also work in newer versions.