SvenskaSpel / har2locust

Convert HTTP Archive (.har file) to a Locust script
Other
149 stars 22 forks source link

Fix payload string generation #17

Closed ivanpuchalka closed 4 months ago

ivanpuchalka commented 4 months ago

Fixes #10.

To ensure the generated string is a valid Python literal, this new code manually creates an instance of an AST constant node with the value parsed from the HAR and then uses ast.unparse.

A few details worth reviewing:

cyberw commented 4 months ago

Thanks!

cyberw commented 4 months ago

The tests break when there are changes in the output, they are a bit weird in that way, but it is by design. There’s a make action to update them. I uses the git diff in the generated output to validate that any changes were good :)