Skip to content

Commit

Permalink
Renamed some variables in the flow id filter
Browse files Browse the repository at this point in the history
  • Loading branch information
lmineiro committed Oct 18, 2015
1 parent 15d749e commit ba8bd57
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion filters/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package filters
import (
// import filter packages here:

"github.com/zalando/skipper/filters/flowid"
"github.com/zalando/skipper/filters/healthcheck"
"github.com/zalando/skipper/filters/humanstxt"
"github.com/zalando/skipper/filters/pathrewrite"
Expand All @@ -12,7 +13,6 @@ import (
"github.com/zalando/skipper/filters/static"
"github.com/zalando/skipper/filters/stripquery"
"github.com/zalando/skipper/skipper"
"github.com/zalando/skipper/filters/flowid"
)

// takes a registry object and registers the filter spec in the package
Expand Down
18 changes: 9 additions & 9 deletions filters/flowid/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package flowid

import (
"github.com/zalando/skipper/skipper"
"strings"
"log"
"strings"
)

const (
Expand All @@ -25,30 +25,30 @@ func New() skipper.FilterSpec {
return &flowIdSpec{}
}

func (this *flowId) Id() string { return this.id }
func (f *flowId) Id() string { return f.id }

func (this *flowId) Request(fc skipper.FilterContext) {
func (f *flowId) Request(fc skipper.FilterContext) {
r := fc.Request()
var flowId string

if this.reuseExisting {
if f.reuseExisting {
flowId = r.Header.Get(flowIdHeaderName)
if isValid(flowId) {
return
}
}

flowId, err := newFlowId(this.flowIdLength)
flowId, err := newFlowId(f.flowIdLength)
if err == nil {
fc.Request().Header.Set(flowIdHeaderName, flowId)
r.Header.Set(flowIdHeaderName, flowId)
} else {
log.Println(err)
}
}

func (this *flowId) Response(skipper.FilterContext) {}
func (f *flowId) Response(skipper.FilterContext) {}

func (this *flowIdSpec) MakeFilter(id string, fc skipper.FilterConfig) (skipper.Filter, error) {
func (spec *flowIdSpec) MakeFilter(id string, fc skipper.FilterConfig) (skipper.Filter, error) {
var reuseExisting bool
if len(fc) > 0 {
if r, ok := fc[0].(string); ok {
Expand All @@ -68,4 +68,4 @@ func (this *flowIdSpec) MakeFilter(id string, fc skipper.FilterConfig) (skipper.
return &flowId{id, reuseExisting, flowIdLength}, nil
}

func (this *flowIdSpec) Name() string { return filterName }
func (spec *flowIdSpec) Name() string { return filterName }

0 comments on commit ba8bd57

Please sign in to comment.