mirror of
https://github.com/chrislusf/seaweedfs
synced 2024-07-06 17:17:25 +02:00
add a {X-,}Idempotency-Key header for http POST
fix https://github.com/chrislusf/seaweedfs/issues/1592 according to https://github.com/golang/go/issues/19943
This commit is contained in:
parent
8708e7a64d
commit
a29abd8600
|
@ -190,6 +190,7 @@ func upload_content(uploadUrl string, fillBufferFunction func(w io.Writer) error
|
||||||
body_writer := multipart.NewWriter(buf)
|
body_writer := multipart.NewWriter(buf)
|
||||||
h := make(textproto.MIMEHeader)
|
h := make(textproto.MIMEHeader)
|
||||||
h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="file"; filename="%s"`, fileNameEscaper.Replace(filename)))
|
h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="file"; filename="%s"`, fileNameEscaper.Replace(filename)))
|
||||||
|
h.Set("Idempotency-Key", uploadUrl)
|
||||||
if mtype == "" {
|
if mtype == "" {
|
||||||
mtype = mime.TypeByExtension(strings.ToLower(filepath.Ext(filename)))
|
mtype = mime.TypeByExtension(strings.ToLower(filepath.Ext(filename)))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue