Skip to content

Is it possible to skip a request? #1215

Answered by mnmkng
windbridges asked this question in Q&A
Discussion options

You must be logged in to vote

I thought preNavigationHooks was the way to go, but there's no access to the request there

You do have access to the request. It's a property of the crawlingContext. There isn't any direct API to do this, but you can set the request to not retry and then throw.

preNavigationHooks: [
    async (crawlingContext, gotoOptions) => {
        const { request } = crawlingContext;
        request.noRetry = true;
        throw new Error('Request cancelled.');
    },
]

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@windbridges
Comment options

Comment options

You must be logged in to vote
1 reply
@windbridges
Comment options

Answer selected by windbridges
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested.
3 participants
Converted from issue

This discussion was converted from issue #1214 on October 20, 2021 07:15.