Skip to content

Commit 6ecdf0e

Browse files
authored
fix(har): omit content when False is passed (microsoft#959)
1 parent d66d27f commit 6ecdf0e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

playwright/_impl/_browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ async def normalize_context_params(is_sync: bool, params: Dict) -> None:
210210
if "recordHarPath" in params:
211211
params["recordHar"] = {"path": str(params["recordHarPath"])}
212212
if "recordHarOmitContent" in params:
213-
params["recordHar"]["omitContent"] = True
213+
params["recordHar"]["omitContent"] = params["recordHarOmitContent"]
214214
del params["recordHarOmitContent"]
215215
del params["recordHarPath"]
216216
if "recordVideoDir" in params:

tests/async/test_har.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,24 @@ async def test_should_omit_content(browser, server, tmpdir):
4040
data = json.load(f)
4141
assert "log" in data
4242
log = data["log"]
43-
4443
content1 = log["entries"][0]["response"]["content"]
4544
assert "text" not in content1
4645

4746

47+
async def test_should_not_omit_content(browser, server, tmpdir):
48+
path = os.path.join(tmpdir, "log.har")
49+
context = await browser.new_context(
50+
record_har_path=path, record_har_omit_content=False
51+
)
52+
page = await context.new_page()
53+
await page.goto(server.PREFIX + "/har.html")
54+
await context.close()
55+
with open(path) as f:
56+
data = json.load(f)
57+
content1 = data["log"]["entries"][0]["response"]["content"]
58+
assert "text" in content1
59+
60+
4861
async def test_should_include_content(browser, server, tmpdir):
4962
path = os.path.join(tmpdir, "log.har")
5063
context = await browser.new_context(record_har_path=path)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy