Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot covert a Charles proxy HAR file into a script #793

Closed
Ardesco opened this issue Oct 2, 2018 · 3 comments · Fixed by #806
Closed

Cannot covert a Charles proxy HAR file into a script #793

Ardesco opened this issue Oct 2, 2018 · 3 comments · Fixed by #806
Labels

Comments

@Ardesco
Copy link

Ardesco commented Oct 2, 2018

Looks like the HAR convertor does not work with har files saved from Charles proxy.

Added an example HTTP Archive and the script created by running the following command (both files in the attached zip):

k6 convert example.har -O example.js

example.zip

@Ardesco Ardesco changed the title Cannot cover a Charles proxy HAR file into a script Cannot covert a Charles proxy HAR file into a script Oct 2, 2018
@na-- na-- added the bug label Oct 2, 2018
@na--
Copy link
Member

na-- commented Oct 2, 2018

Confirmed, this is a bug - seems like the k6 HAR converter assumes that there's a pages key in the HAR file. This makes sense for HAR files recorded in browsers, but proxies would have no idea what to put there so they don't include it. And regardless, the spec says that pages is optional, so we shouldn't depend on it...

Until we fix this (probably together with the rest of the several HAR converter improvement we want to make and issues we have to fix), you can work around the problem by manually editing the .har file and inserting a dummy page with "" for ID, like this:

{
  "log": {
    "version": "1.2",
    "creator": {
      "name": "Charles Proxy",
      "version": "4.2.7"
    },
    "pages": [
      {
        "id": "",
        "title": "dummy"
      }
    ],
    "entries": [
      /* ... */
    ]
  }
}

@Ardesco
Copy link
Author

Ardesco commented Oct 4, 2018

Workaround works perfectly, thanks :)

@na--
Copy link
Member

na-- commented Oct 11, 2018

Received another issue about this (non-Charles Proxy related), so I think we should fix it before 1.0. The quick fix should be easy enough, we can just officially use the minor hack I proposed as a workaround - inserting a placeholder element in pages if it's empty... We're going to majorly refactor (for this among other reasons) the HAR converter post 1.0, so we'll properly deal with it when that happens, but the quick fix should suffice until then.

@na-- na-- added this to the v1.0.0 milestone Oct 11, 2018
na-- added a commit that referenced this issue Oct 11, 2018
This is a hacky and hopefully temporary fix so we can close #793
@na-- na-- closed this as completed in #806 Oct 12, 2018
na-- added a commit that referenced this issue Oct 12, 2018
)

This is a hacky and hopefully temporary fix so we can close #793
@na-- na-- removed this from the v1.0.0 milestone Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants