Skip to content

Commit

Permalink
feat: VENOM_PRESERVE_CASE default ON
Browse files Browse the repository at this point in the history
It's now possible to read something like that :

```json
{
  "foo": "bar",
  "FOO": "truc",
}
```
and use these variables:

```yml
- type: readfile
    path: the_file.json
    info: "{{.Result.ContentJSON.foo}}-{{.Result.ContentJSON.FOO}}"
```

Environment variable: VENOM_PRESERVE_CASE

venom 1.1.x
  VENOM_PRESERVE_CASE="AUTO" is equals to VENOM_PRESERVE_CASE="OFF"

venom 1.2.x
  VENOM_PRESERVE_CASE="AUTO" is equals to VENOM_PRESERVE_CASE="ON"

venom 1.1 users, you can try:

```sh
> export VENOM_PRESERVE_CASE="ON";
> venom run ...
```

Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
  • Loading branch information
yesnault authored and fsamin committed Feb 14, 2023
1 parent 4a8b0d6 commit d1c091d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var preserveCase string
func init() {
preserveCase = os.Getenv("VENOM_PRESERVE_CASE")
if preserveCase == "" || preserveCase == "AUTO" {
preserveCase = "OFF"
preserveCase = "ON"
}
}

Expand Down
10 changes: 10 additions & 0 deletions tests/case.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Readfile testsuite

testcases:
- name: testcase-readfile
steps:
- script: 'echo "{\"foo\": \"foo\", \"FOO\": \"bar\"}"'
info: "{{.result.systemoutjson.foo}}-{{.result.systemoutjson.FOO}}"
assertions:
- result.systemoutjson.foo ShouldEqual foo
- result.systemoutjson.FOO ShouldEqual bar
6 changes: 3 additions & 3 deletions tests/interpolation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ testcases:
- result.statuscode ShouldEqual 200
vars:
accept:
from: result.headers.content-type
from: result.headers.Content-Type

- name: UseVar
steps:
Expand All @@ -24,12 +24,12 @@ testcases:
test: "{{ .GetVar.accept }}"
assertions:
- result.statuscode ShouldEqual 200
- result.headers.x-cache ShouldEqual "HIT"
- result.headers.X-Cache ShouldEqual "HIT"
- type: http
method: HEAD
url: "http://example.com"
headers:
test: "{{ .GetVar.accept }}"
assertions:
- result.statuscode ShouldEqual 200
- result.headers.accept-ranges ShouldEqual "bytes"
- result.headers.Accept-Ranges ShouldEqual "bytes"

0 comments on commit d1c091d

Please sign in to comment.