pkg/httpx/httpx.go
@@ -5,6 +5,7 @@ "encoding/json" "io/ioutil" "net/http" "os" "time" ) @@ -39,3 +40,16 @@ } return respBytes, nil } func GetMimeType(filePath string) string { file, err := os.Open(filePath) if err != nil { return "" } buffer := make([]byte, 512) _, _ = file.Read(buffer) if len(buffer) == 0 { return "" } return http.DetectContentType(buffer) }