cyrus-and / chrome-har-capturer

Capture HAR files from a Chrome instance
MIT License
535 stars 90 forks source link

bodySize from getHeaderValue is returning the header key instead of value #49

Closed calvinnwq closed 7 years ago

calvinnwq commented 7 years ago

In the generate HAR, some entries have their request bodySize returning as string of value "content-length".

{
    "pageref": "page_1",
    "startedDateTime": "2017-08-24T01:27:11.769Z",
    "time": 149.27100000204518,
    "request": {
        "method": "POST",
        "url": "...",
        "httpVersion": "h2",
        "cookies": [],
        "headers": [
            ...
            {
                "name": "content-length",
                "value": "311"
            },
            ...
        ],
        "queryString": [],
        "headersSize": -1,
        "bodySize": "content-length"
    },
    ...
}

This is because the value being returned is the key and not the value.

https://github.com/cyrus-and/chrome-har-capturer/blob/8b6217ea1a3e13fa124e9a57f4dd22dbbd7f2c5c/lib/har.js#L277-L283

cyrus-and commented 7 years ago

Fixed in dc0b58f784cc417df6279353764c97b746bef795.