Answer the question
In order to leave comments, you need to log in
Replacing request: why doesn't it work in a loop?
Due to the untimely death of the module request
, I decided, as a real hipster, to find a fashionable replacement. Everyone recommends a module got
from one of the top mods in the Javascript world. Decided to try it and immediately ran into a problem.
while (currentPage <= lastPage) {
const response = await got(`http://example.com/?page=${currentPage}`);
currentPage++
}
got
sends a request constantly only to 1 page (i.e. the first iteration. I tried to replace all the same, just instead of it the good old one request
- everything works without problems. But this bastard does not work. What is it and how?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question