Closed adamkiss closed 2 years ago
Make sure you're using the latest version: https://github.com/sindresorhus/alfy/releases/tag/v0.12.3
@sindresorhus I am using the latest, but instead of turning JSON parsing off, alfy passess the json: false
to got, which then interprets it as request body, which then fails for GET requests.
Instead, alfy.fetch
should detect the json: false
, unset it, and call .response
instead of .json()
on https://github.com/sindresorhus/alfy/blob/8e88725417077b651a17098334afb05db84cb28c/index.js#L142
At least I think, unless fetching other formats other than JSON isn't supported anymore
I'm using the
alfy.fetch
to fetch a HTML file I later parse. Whenever I call it withjson: false
, I get back theCannot use 'GET' with body
error for some reason. I tried to hunt the error down the line, but looking at theindex.js
, I don't see the json option read anywhere and the response always parsed asjson()
, so perhaps thejson
option is passed through togot
as a body?Edit: looking at the blame of the file, I see that for whatever reason, @jopemachine removed the option while bumping
got
in https://github.com/sindresorhus/alfy/commit/56aed04cff57d49635a8182af8aa696c70852bfaIs it not supposed to be an option anymore, or is that an error?