Search code examples
google-chrome-devtoolsmultipart

File contents of multipart file upload not shown in HAR (Http Archive) produced by Google Chrome


I am uploading a CSV file to a server and while debugging it I wanted to make use of the HAR file produced by google chrome developer tools.

The postData of the request I am interested in does not show the content of the uploaded file. I get this:

"postData": { "mimeType": "multipart/form-data; boundary=----WebKitFormBoundaryS0nORM7anPTbfGxB", "text": "------WebKitFormBoundaryS0nORM7anPTbfGxB\r\nContent-Disposition: form-data; name=\"instrumentType\"\r\n\r\nFuture\r\n------WebKitFormBoundaryS0nORM7anPTbfGxB\r\nContent-Disposition: form-data; name=\"csv\"; filename=\"Book5.csv\"\r\nContent-Type: text/csv\r\n\r\n\r\n------WebKitFormBoundaryS0nORM7anPTbfGxB--\r\n" }

Why don't I see the content of the file?


Solution

  • Reading up on this a bit more, I see HAR is intended to be used to represent performance data. Its not intended necessarily to represent an entire request. The relevant section from the spec at (https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HAR/Overview.html) is

    "postData": {
        "mimeType": "multipart/form-data",
        "params": [],
        "text" : "plain posted data",
        "comment": ""
    }
    

    There is no promise in the spec that text will contain the entire request entity, so I guess if HAR is interested only in performance data, its fair enough to drop file upload content.