Skip to content

Commit

Permalink
fix(handler): fix download response header Content-Encoding error
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-pony committed Oct 8, 2024
1 parent a28631a commit c3cea97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ coverage-twisted/
node_modules/
package-lock.json
package.json

.idea
4 changes: 3 additions & 1 deletion scrapy_playwright/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,12 @@ async def _download_request_with_page(
if download:
request.meta["playwright_suggested_filename"] = download.suggested_filename
respcls = responsetypes.from_args(url=download.url, body=download.body)
download_headers = Headers(download.headers)
download_headers.pop("Content-Encoding", None)
return respcls(
url=download.url,
status=download.response_status,
headers=Headers(download.headers),
headers=download_headers,
body=download.body,
request=request,
flags=["playwright"],
Expand Down

0 comments on commit c3cea97

Please sign in to comment.