提交 9c641f99 作者: Jeromy

cleanup multipart

License: MIT
Signed-off-by: 's avatarJeromy <jeromyj@gmail.com>
上级 a9d6575b
......@@ -96,7 +96,6 @@ func (c *client) Send(req cmds.Request) (cmds.Response, error) {
// TODO extract string consts?
if fileReader != nil {
httpReq.Header.Set(contentTypeHeader, "multipart/form-data; boundary="+fileReader.Boundary())
httpReq.Header.Set(contentDispHeader, "form-data: name=\"files\"")
} else {
httpReq.Header.Set(contentTypeHeader, applicationOctetStream)
}
......
......@@ -92,12 +92,7 @@ func (mfr *MultiFileReader) Read(buf []byte) (written int, err error) {
// write the boundary and headers
header := make(textproto.MIMEHeader)
filename := url.QueryEscape(file.FileName())
if mfr.form {
contentDisposition := fmt.Sprintf("form-data; name=\"file\"; filename=\"%s\"", filename)
header.Set("Content-Disposition", contentDisposition)
} else {
header.Set("Content-Disposition", fmt.Sprintf("file; filename=\"%s\"", filename))
}
header.Set("Content-Disposition", fmt.Sprintf("file; filename=\"%s\"", filename))
header.Set("Content-Type", contentType)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论