HAR request bodies for application/x-www-form-urlencoded may be encoded
as postData.params (array of {name, value}) with no postData.text field
(e.g. Chrome DevTools export). _body_bytes read only text, so those
bodies were silently dropped and the generated client method lost its
request fields. Fall back to url-encoding params when text is absent,
matching the HAR spec.
Fixes#8
Co-authored-by: thejesh23 <thejesh23@users.noreply.github.com>
The sources/__init__.py docstring promised "cURL/HAR paste" but HAR was
never implemented. This adds it, so mimic works with browser devtools
exports (Chrome, Firefox, Safari) and desktop proxies (Charles, Proxyman)
with no mitmproxy or iPhone setup.
- new mimic/sources/har.py parses HAR JSON into mimic's flow dicts, with
inline request/response bodies (base64 decoded) for codegen
- Session.from_har(path, host) constructor; host defaults to the
most-requested one
- --har flag on the hosts, learn, and gen commands
- tests/test_har.py with a small fixture
The HAR-to-flow conversion produces the same dict shape extract.py and
codegen.py already consume, so those modules are untouched.
Signed-off-by: ZhYGuoL <zguoliau@andrew.cmu.edu>