Skip to content

Commit

Permalink
Removed request from NewFetchDefinitionWithPriority because of client…
Browse files Browse the repository at this point in the history
… incompatibilities.
  • Loading branch information
rob committed Dec 9, 2016
1 parent d7f166c commit c0a802f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 3 additions & 5 deletions composition/content_fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"testing"
"time"
"sort"
"net/http"
)

func Test_ContentFetcher_FetchingWithDependency(t *testing.T) {
Expand Down Expand Up @@ -79,11 +78,10 @@ func getFetchDefinitionMock(ctrl *gomock.Controller, loaderMock *MockContentLoad

func Test_ContentFetchResultPrioritySort(t *testing.T) {
a := assert.New(t)
request := &http.Request{}

barFd := NewFetchDefinitionWithPriority("/bar", request, 30)
fooFd := NewFetchDefinitionWithPriority("/foo", request, 10)
bazzFd := NewFetchDefinitionWithPriority("/bazz", request, 5)
barFd := NewFetchDefinitionWithPriority("/bar", 30)
fooFd := NewFetchDefinitionWithPriority("/foo", 10)
bazzFd := NewFetchDefinitionWithPriority("/bazz", 5)

results := []*FetchResult{{Def: barFd}, {Def: fooFd}, {Def: bazzFd}}

Expand Down
7 changes: 5 additions & 2 deletions composition/fetch_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,13 @@ func NewFetchDefinition(url string) *FetchDefinition {
}
}

func NewFetchDefinitionWithPriority(url string, r *http.Request, priority int) *FetchDefinition {
return NewFetchDefinitionWithResponseProcessorAndPriority(url, nil, r, priority)
func NewFetchDefinitionWithPriority(url string, priority int) *FetchDefinition {
fd := NewFetchDefinition(url)
fd.Priority = priority
return fd
}


// If a ResponseProcessor-Implementation is given it can be used to change the response before composition
// Priority is used to determine which property from which head has to be taken by collision of multiple fetches
func NewFetchDefinitionWithResponseProcessorAndPriority(url string, rp ResponseProcessor, r *http.Request, priority int) *FetchDefinition {
Expand Down
2 changes: 1 addition & 1 deletion composition/fetch_definition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func Test_FetchDefinition_NewFunctions_have_parameter_priority(t *testing.T) {
request := &http.Request{}
request.URL = &url.URL{}

fd1 := NewFetchDefinitionWithPriority("foo", request, 42)
fd1 := NewFetchDefinitionWithPriority("foo", 42)
fd2 := NewFetchDefinitionWithPriorityFromRequest("baa", request, 54)
fd3 := NewFetchDefinitionWithResponseProcessorAndPriorityFromRequest("blub", request, nil, 74)

Expand Down

0 comments on commit c0a802f

Please sign in to comment.