diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-06-05 12:44:45 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-06-06 13:32:12 +0200 |
commit | fcd63de3a54fadcd30972654d8eb86dc4d889784 (patch) | |
tree | 5140863493b65783f73ecab8885f684fc623b1da /tpl/data/resources.go | |
parent | 150d75738b54acddc485d363436757189144da6a (diff) |
tpl/data: Misc header improvements, tests, allow multiple headers of same key
Closes #5617
Diffstat (limited to 'tpl/data/resources.go')
-rw-r--r-- | tpl/data/resources.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tpl/data/resources.go b/tpl/data/resources.go index ba98f12b4..68f18c48e 100644 --- a/tpl/data/resources.go +++ b/tpl/data/resources.go @@ -14,6 +14,7 @@ package data import ( + "bytes" "io/ioutil" "net/http" "net/url" @@ -37,7 +38,9 @@ var ( // getRemote loads the content of a remote file. This method is thread safe. func (ns *Namespace) getRemote(cache *filecache.Cache, unmarshal func([]byte) (bool, error), req *http.Request) error { url := req.URL.String() - id := helpers.MD5String(url) + var headers bytes.Buffer + req.Header.Write(&headers) + id := helpers.MD5String(url + headers.String()) var handled bool var retry bool @@ -94,10 +97,6 @@ func (ns *Namespace) getRemote(cache *filecache.Cache, unmarshal func([]byte) (b // getLocal loads the content of a local file func getLocal(url string, fs afero.Fs, cfg config.Provider) ([]byte, error) { filename := filepath.Join(cfg.GetString("workingDir"), url) - if e, err := helpers.Exists(filename, fs); !e { - return nil, err - } - return afero.ReadFile(fs, filename) } |