From 39d7ba852c38e45322a55794fba9e06d7fcbc6ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slobodan=20Mi=C5=A1kovi=C4=87?= Date: Mon, 24 Oct 2016 14:34:04 -0700 Subject: [PATCH] Include `boudary=...` in mutipart postData While the HAR spec is not very explicit and their example shows just this one example: ```json "postData": { "mimeType": "multipart/form-data" } ``` Would it not make sense to include all the information necessary to parse out the post data `text`. Eg. ```json "postData": { "text": "--xYzZY\r\nContent-Disposition: form-data; name=\"sort1\"\r\n\r\noldest date first\r\n--xYzZY--\r\n", "mimeType": "multipart/form-data; boundary=xYzZY" }, ``` Currently, full mimeType is included only in `content-type` request header. Elsewhere in HAR spec they include the 'extras', eg ```json "content": { "mimeType": "text/html; charset=utf-8" } ``` So one could argue that `mimeType` should include all information necessary to interpret the data. In case of `multipart/form-data`, as per RFC2046 http://www.ietf.org/rfc/rfc2046.txt ``` The Content-Type field for multipart entities requires one parameter, "boundary". ``` I believe that earlier incarnations, eg `har_exporter.py` included it in the mimeType. --- examples/har_dump.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/har_dump.py b/examples/har_dump.py index efcf9d74b..ab7bf1e14 100644 --- a/examples/har_dump.py +++ b/examples/har_dump.py @@ -140,7 +140,7 @@ def response(flow): for a, b in flow.request.urlencoded_form.items(multi=True) ] entry["request"]["postData"] = { - "mimeType": flow.request.headers.get("Content-Type", "").split(";")[0], + "mimeType": flow.request.headers.get("Content-Type", ""), "text": flow.request.get_text(strict=False), "params": params }