Skip to content

Commit

Permalink
doc: faq about json and quotes (#383)
Browse files Browse the repository at this point in the history
close #381

Signed-off-by: Yvonnick Esnault <[email protected]>
  • Loading branch information
yesnault authored Mar 8, 2021
1 parent 019b1b5 commit 2349265
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,54 @@ testcases:
```

# FAQ

## Common errors with quotes

If you have this kind of error:

```
err:unable to parse file "foo.yaml": error converting YAML to JSON: yaml: line 8: did not find expected key
```

this is probably because you try to use a json value instead of a string. You should have more details in venom.log file.

Wrong:

```yml
...
vars:
body: >-
{
"the-attribute": "the-value"
}
...
steps:
- type: http
body: "{{.body}}"
...
```

OK:


```yml
...
vars:
body: >-
{
"the-attribute": "the-value"
}
...
steps:
- type: http
body: '{{.body}}'
...
```

Note the simple quote on the value of `body`.


# Use venom in CI

Venom can be use on dev environement or your CI server.
Expand Down
2 changes: 1 addition & 1 deletion venom.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (v *Venom) registerUserExecutors(ctx context.Context, name string, ts TestS

ux := UserExecutor{Filename: f}
if err := yaml.Unmarshal([]byte(content), &ux); err != nil {
return errors.Wrapf(err, "unable to parse file %q", f)
return errors.Wrapf(err, "unable to parse file %q with content %v", f, content)
}

for k, vr := range varsComputed {
Expand Down

0 comments on commit 2349265

Please sign in to comment.