Skip to content

Commit

Permalink
Return contentwrapper after chaching stream content, instead of setti…
Browse files Browse the repository at this point in the history
…ng the reader of the old content object
  • Loading branch information
Dino Omanovic committed Jul 11, 2016
1 parent f0d05ba commit 0f72e3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composition/cache_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (loader *CachingContentLoader) Load(fd *FetchDefinition) (Content, error) {
streamBytes: streamBytes,
}
loader.cache.Set(hash, fd.URL, c.MemorySize(), cw)
c.SetReader(cw.Reader())
return cw, err
}
} else {
loader.cache.Set(hash, fd.URL, c.MemorySize(), c)
Expand Down
4 changes: 3 additions & 1 deletion composition/cache_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ func Test_CacheLoader_NotFound_With_Stream(t *testing.T) {

// it is returned
result, err := loader.Load(fd)
resultbytes, err := ioutil.ReadAll(result.Reader())
resultstring := string(resultbytes)
a.NoError(err)
a.Equal(c, result)
a.Equal("foobar", resultstring)
ctrl.Finish()
}
}
Expand Down

0 comments on commit 0f72e3e

Please sign in to comment.