aboutsummaryrefslogtreecommitdiff
path: root/weed/operation/upload_content.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2019-02-18 15:05:32 -0800
committerGitHub <noreply@github.com>2019-02-18 15:05:32 -0800
commit9a4dda30118fa4e076b2ef4ea6abe14ca898a84e (patch)
treec5d379b2a92d78607e82246ca2abed09bd1c0b2d /weed/operation/upload_content.go
parenta1c7dc380683d44e59a18c2e71c9c3aa7734835f (diff)
parent77b9af531d18e10b04b49b069b5f26a329ed4902 (diff)
downloadseaweedfs-9a4dda30118fa4e076b2ef4ea6abe14ca898a84e.tar.xz
seaweedfs-9a4dda30118fa4e076b2ef4ea6abe14ca898a84e.zip
Merge pull request #855 from chrislusf/add_jwt
Add jwt
Diffstat (limited to 'weed/operation/upload_content.go')
-rw-r--r--weed/operation/upload_content.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.go
index 030bf5889..be7b8e69c 100644
--- a/weed/operation/upload_content.go
+++ b/weed/operation/upload_content.go
@@ -58,9 +58,6 @@ func upload_content(uploadUrl string, fillBufferFunction func(w io.Writer) error
if isGzipped {
h.Set("Content-Encoding", "gzip")
}
- if jwt != "" {
- h.Set("Authorization", "BEARER "+string(jwt))
- }
file_writer, cp_err := body_writer.CreatePart(h)
if cp_err != nil {
@@ -86,6 +83,9 @@ func upload_content(uploadUrl string, fillBufferFunction func(w io.Writer) error
for k, v := range pairMap {
req.Header.Set(k, v)
}
+ if jwt != "" {
+ req.Header.Set("Authorization", "BEARER "+string(jwt))
+ }
resp, post_err := client.Do(req)
if post_err != nil {
glog.V(0).Infoln("failing to upload to", uploadUrl, post_err.Error())