Make HAR files compatible with Firefox DevTools (#5666)

Firefox Developer Tools reject to load HAR files that do not have
`har.log.pages` element (see
<https://bugzilla.mozilla.org/show_bug.cgi?id=1691240>). Adding a
placeholder entry fixes it.

Co-authored-by: Maciej Zielenkiewicz <maciej.zielenkiewicz@connectpoint.pl>
This commit is contained in:
m4ci3k2 2022-10-21 01:54:07 +02:00 committed by GitHub
parent 4f6e8681a7
commit c0f25e0470
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,9 +46,16 @@ def configure(updated):
"version": "0.1",
"comment": "mitmproxy version %s" % version.MITMPROXY
},
"pages": [
{
"pageTimings": {}
}
],
"entries": []
}
})
# The `pages` attribute is needed for Firefox Dev Tools to load the HAR file.
# An empty value works fine.
def response(flow: mitmproxy.http.HTTPFlow):