-
-
Notifications
You must be signed in to change notification settings - Fork 935
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
hooks are being duplicated with each pagination.paginate()
iteration
#1223
Comments
@szmarczak Here is an ugly but functional test case. // Nicer test case in PR #1231 |
Kludgy workaround, add this line first in your Reflect.deleteProperty(response.request.options, 'hooks'); |
That's actually an invalid use case. The options are merged. You return the request options, which already include hooks. But I'm fixing it rn. |
Using Got@11.1.3 without the above kludge:
|
Are you sure you're not doing |
The tests are passing... |
Odd. Tests do pass indeed.But real use case fails without the kludge (I double checked with and without twice.) But it seems to takes longer to crash though. I guess I need to debug deeper and check what is happening. The effective |
Hold on. You're right. And re-reading the I am reading it right now? |
yes. |
Cuz I have just updated the readme lol, no worries. |
It explicitly mentions that:
|
To summarise:
|
Actually that's my mistake I didn't document it better... I hope it's clear now. |
Describe the bug
This issue was discovered while investigating #1221
Guess what? I have one single
afterResponse
hook.Now if I inspect
normalizedOptions.hooks.afterResponse
innode_modules/got/dist/source/create.js@94
, its length double at each iteration (i.e. 2 at page 2, 4 at page 3, 8 at page 4, etc.)Funny for I was about to add my share to #1220 .
Actual behavior
the
hooks.afterResponse
array is double with eachpagination.paginate()
iterationExpected behavior
the
hooks.afterResponse
array should not changed duringpagination()
processingCode to reproduce
Checklist
The text was updated successfully, but these errors were encountered: