-
-
Notifications
You must be signed in to change notification settings - Fork 957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Got RequestError when explicitly set responseType to undefined #1252
Comments
According to the documentation responseType must be a string ( That behavior is due to this code: |
Thank you, I know that |
In Got v10 there was this line after the merge (between default values and user options) got/source/normalize-arguments.ts Line 228 in 5c74084
That took care of defaulting responseType to 'text' event if it was overwritten by the user options as undefined .
This is because I don't mean to be rude but you where using it wrong, even the Got v10 documentation states that it must be
|
Options are optional, so when you pass anything as |
Describe the bug
The project at my company uses
got-fetch
library, which usesgot
as peer dependency to create fetch-like function. Starting withgot
v11.1.1, we encounter this error when usinggot-fetch
:After investigating the source code, we found that
got-fetch
setsresponseType
to beundefined
and parses the response body by itself.got-fetch/src/lib/fetch.ts:53
When we run test code with
responseType
explicitly set toundefined
, we also got the same behavior. This behavior does not happen ingot
v11.1.0 and before.Actual behavior
Got throws
RequestError: Unknown body type 'undefined'
.Expected behavior
Got throws no error and return response as normal.
Code to reproduce
Checklist
The text was updated successfully, but these errors were encountered: