core icon indicating copy to clipboard operation
core copied to clipboard

Responses dropped by middlewares are not registered

Open Fadarrizz opened this issue 1 year ago • 1 comments

Firstly, I really like this package. Really nice work!

In my app, I want to act based on the fact if the ExecuteJavascriptMiddleware drops a response.

However, this is not registered anywhere besides info logging, resulting in an empty array of items without an exception or event raised.

After digging in, I saw the Downloader class doesn't do anything when noticing a dropped response by a middleware (Downloader.php, line 131-137):

        ...
        foreach ($this->middleware as $middleware) {
            $response = $middleware->handleResponse($response);

            if ($response->wasDropped()) {
                return;
            }
        }
       ...

Shouldn't this dispatch a ResponseDropped event or something else?

I'm willing to provide a PR if we can figure out a solution.

Thanks for the help!

Fadarrizz avatar Mar 03 '24 12:03 Fadarrizz

You're right, this is a bug. Thanks for pointing this out!

I will fix this in a future version since there are other things around the ResponseDropped event that aren't working as intended at the moment.

ksassnowski avatar Apr 04 '24 09:04 ksassnowski