Skip to content

Commit

Permalink
HTTP scenario var/header postprocessor use multiple pipes
Browse files Browse the repository at this point in the history
803e9ad581cd4a1790bd6c50c41f58c27724f6ac
  • Loading branch information
oke11o committed Jun 27, 2024
1 parent c89292c commit 14d9dd0
Show file tree
Hide file tree
Showing 13 changed files with 327 additions and 251 deletions.
3 changes: 3 additions & 0 deletions .changes/v0.5.29.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## v0.5.29 - 2024-06-25
### Added
* HTTP scenario var/header postprocessor use multiple pipes
1 change: 1 addition & 0 deletions .mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
".changes/v0.5.26.md":"load/projects/pandora/.changes/v0.5.26.md",
".changes/v0.5.27.md":"load/projects/pandora/.changes/v0.5.27.md",
".changes/v0.5.28.md":"load/projects/pandora/.changes/v0.5.28.md",
".changes/v0.5.29.md":"load/projects/pandora/.changes/v0.5.29.md",
".changie.yaml":"load/projects/pandora/.changie.yaml",
".github/actions/setup-yc/action.yml":"load/projects/pandora/.github/actions/setup-yc/action.yml",
".github/workflows/release.yml":"load/projects/pandora/.github/workflows/release.yml",
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).


## v0.5.29 - 2024-06-25
### Added
* HTTP scenario var/header postprocessor use multiple pipes

## v0.5.28 - 2024-06-24
### Changed
* `discard_overflow` logic. Waiter wait 2 seconds sliding window before skip payload
Expand Down
2 changes: 1 addition & 1 deletion cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"go.uber.org/zap/zapcore"
)

const Version = "0.5.28"
const Version = "0.5.29"
const defaultConfigFile = "load"
const stdinConfigSelector = "-"

Expand Down
21 changes: 14 additions & 7 deletions components/providers/scenario/http/postprocessor/var_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,22 @@ func (p *VarHeaderPostprocessor) parseValue(v string) (value string, modifier fu
if len(vals) == 1 {
return vals[0], func(in string) string { return in }, nil
}
if len(vals) > 2 {
return "", nil, fmt.Errorf("VarHeaderPostprocessor supports only one modifier yet")
}
modifier, err = p.parseModifier(vals[1])
if err != nil {
return "", nil, fmt.Errorf("failed to parse modifier %s: %w", vals[1], err)

value = vals[0]
modifier = func(in string) string { return in }

for _, modStr := range vals[1:] {
mod, err := p.parseModifier(modStr)
if err != nil {
return "", nil, fmt.Errorf("failed to parse modifier %s: %w", modStr, err)
}
previousModifier := modifier
modifier = func(in string) string {
return mod(previousModifier(in))
}
}

return vals[0], modifier, nil
return value, modifier, nil
}

func (p *VarHeaderPostprocessor) parseModifier(s string) (func(in string) string, error) {
Expand Down
Loading

0 comments on commit 14d9dd0

Please sign in to comment.