Skip to content

Commit 8ba4448

Browse files
authored
fix(handler): fix download response header Content-Encoding error (#322)
1 parent 5500a6e commit 8ba4448

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ coverage-twisted/
2222
node_modules/
2323
package-lock.json
2424
package.json
25+
26+
.idea

scrapy_playwright/handler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,10 +504,12 @@ async def _download_request_with_page(
504504
if download:
505505
request.meta["playwright_suggested_filename"] = download.suggested_filename
506506
respcls = responsetypes.from_args(url=download.url, body=download.body)
507+
download_headers = Headers(download.headers)
508+
download_headers.pop("Content-Encoding", None)
507509
return respcls(
508510
url=download.url,
509511
status=download.response_status,
510-
headers=Headers(download.headers),
512+
headers=download_headers,
511513
body=download.body,
512514
request=request,
513515
flags=["playwright"],

0 commit comments

Comments
 (0)