Browse Source

Add HandleImagePng func

Volodymyr Tkach 2 years ago
parent
commit
82b3e875d6
1 changed files with 5 additions and 0 deletions
  1. 5 0
      utils/http/helpers/helpers.go

+ 5 - 0
utils/http/helpers/helpers.go

@@ -19,6 +19,7 @@ import (
 // func ClientIPs(r *http.Request) []string
 // func HandleAppStatus() http.Handler
 // func HandleFile(data, contentType string) http.Handler
+// func HandleImagePng(data string) http.Handler
 // func MinifyHtmlCode(str string) string
 // func RespondAsBadRequest(w http.ResponseWriter, r *http.Request, err error)
 // func RespondAsMethodNotAllowed(w http.ResponseWriter, r *http.Request)
@@ -82,6 +83,10 @@ func HandleFile(data, contentType string) http.Handler {
 	})
 }
 
+func HandleImagePng(data string) http.Handler {
+	return HandleFile(data, "image/png")
+}
+
 func MinifyHtmlCode(str string) string {
 	str = mHtml.ReplaceAllString(str, "><")
 	str = mHtmlLeft.ReplaceAllString(str, ">")