Skip to content

Commit

Permalink
feat(headers): add flag that allow force override headers
Browse files Browse the repository at this point in the history
  • Loading branch information
aldor007 committed Oct 22, 2019
1 parent da5a722 commit a76208f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ type Bucket struct {
// HeaderYaml allow you to override response headers
type HeaderYaml struct {
StatusCodes []int `yaml:"statusCodes"`
Override bool `yaml:"override`
Values map[string]string `yaml:"values"`
}

Expand Down
4 changes: 3 additions & 1 deletion pkg/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,9 @@ func updateHeaders(obj *object.FileObject, res *response.Response) *response.Res
for _, status := range headerPred.StatusCodes {
if status == res.StatusCode {
for h, v := range headerPred.Values {
if res.Headers.Get(h) == "" {
if headerPred.Override {
res.Set(h, v)
} else if res.Headers.Get(h) == "" {
res.Set(h, v)
}
}
Expand Down

0 comments on commit a76208f

Please sign in to comment.