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
RequestError: Cannot read property 'bind' of undefined #1318
Comments
|
@Giotino Thanks for investigating this 🙌 Yes, Modifying option without returning works fine 👍 Anyways, this solution solves my problem. Closing the issue. |
According to the documentation of got 10.7.0 returning something on In 10.7.0 the return value of that hooks was simply discarded got/source/request-as-event-emitter.ts Lines 318 to 321 in 5c74084
In 11 is used as the response Lines 1361 to 1370 in 47239e3
|
Thanks for the great explanation 🙌 I probably misunderstood this part of the README.
My understanding was when Anyways, now it's clear 👍 |
@Giotino @ganapativs It's now documented: 779062a |
@szmarczak Awesome 🙌 |
Describe the bug
Actual behavior
Request fails with error
RequestError: Cannot read property 'bind' of undefined
when array of functions is passed tobeforeRequest
hook.This bug was introduced after upgrading from version
10.6.0
to11.3.0
. This feature works well till version10.7.0
.Demo: https://codesandbox.io/s/got-bug-1130-not-working-hs678
StackTrace:
Expected behavior
Request should succeed when an array of functions is passed to
beforeRequest
hook.This feature should be supported as mentioned in https://github.com/sindresorhus/got#hooksbeforerequest.
Demo: https://codesandbox.io/s/got-bug-1070-working-0ih5w
Code to reproduce
In version
11.3.0
, everything works fine when a single function is passed to thebeforeRequest
hook and breaks when multiple functions are passed.But, the
afterResponse
hook supports array of functions in version10.6.0
and11.3.0
too.Demo: https://codesandbox.io/s/got-bug-1130-working-afterresponse-ihuy9
Am I missing something or is this a bug? 🤔
Checklist
The text was updated successfully, but these errors were encountered: