diff --git a/crawlera_fetch/middleware.py b/crawlera_fetch/middleware.py index b2a2467..73dac6f 100644 --- a/crawlera_fetch/middleware.py +++ b/crawlera_fetch/middleware.py @@ -260,6 +260,9 @@ def process_response(self, request: Request, response: Response, spider: Spider) url=json_response["url"], body=resp_body, ) + + original_request = original_request.replace(url=json_response["url"]) + return response.replace( cls=respcls, request=original_request,