sitespeedio / chrome-har

Create HAR files from Chrome Debugging Protocol data
MIT License
149 stars 50 forks source link

Wrong value type for entry request params #23

Open vlad4800 opened 6 years ago

vlad4800 commented 6 years ago

The value field should be a string according to: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HAR/Overview.html#sec-object-types-params, instead it is an object.

This doesn't happen all the time, but sometimes it does. So if the value is a Json, I think it should be escaped, somehow, to not break the RFC.

I just replaced the title and url.

value [string, optional] - value of a posted parameter or content of a posted file.

{
  "request": {
    "method": "GET",
    "postData": {
      "params": [
        {
          "name": "feedUrls",
          "value": {
            "Title": "xxTitlexx",
            "Url": "xxUrlxx",
            "ImageHandling": 1
          }
        }
      ]
    }
  }
}
soulgalore commented 6 years ago

Thanks @vlad4800 for creating the issue! Let us take a look at it when we get a chance, at the moment we are in vacation mode, see https://github.com/sitespeedio/sitespeed.io#vacation-july---august

If you could start a PR however that would be super.

Best Peter

tobli commented 6 years ago

The solution is probably just to delete these lines: https://github.com/sitespeedio/chrome-har/blob/master/index.js#L763-L768 Trying to fit JSON encoded post data into anything but a plain text is just a fool's errand.