Browse Source

rest files mime type

0x4a52466c696e74 8 tháng trước cách đây
mục cha
commit
b9420805a1
1 tập tin đã thay đổi với 7 bổ sung2 xóa
  1. 7 2
      rest_http/rest.go

+ 7 - 2
rest_http/rest.go

@@ -126,11 +126,16 @@ func (s *Rest) handle(w http.ResponseWriter, r *http.Request) {
 					)
 					responseError(w, err, 500)
 				}
-				rlFile := rest.NewReadCloserLen(
+				upFile := rest.NewReadCloserLen(
 					file,
 					header.Size,
 				)
-				files[filename] = rlFile
+				rFile := &rest.MimeFile{
+					Name:     filename,
+					MimeType: header.Header.Get("Content-Type"),
+					File:     upFile,
+				}
+				files[filename] = rFile
 			}
 		}
 		defer rr.RClose()