Browse Source

Add HandleTextJavaScript, HandleTextPlain funcs

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

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

@@ -20,6 +20,8 @@ import (
 // func HandleAppStatus() http.Handler
 // func HandleFile(data, contentType string) http.Handler
 // func HandleImagePng(data string) http.Handler
+// func HandleTextJavaScript(data string) http.Handler
+// func HandleTextPlain(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)
@@ -87,6 +89,14 @@ func HandleImagePng(data string) http.Handler {
 	return HandleFile(data, "image/png")
 }
 
+func HandleTextJavaScript(data string) http.Handler {
+	return HandleFile(data, "text/javascript")
+}
+
+func HandleTextPlain(data string) http.Handler {
+	return HandleFile(data, "text/plain")
+}
+
 func MinifyHtmlCode(str string) string {
 	str = mHtml.ReplaceAllString(str, "><")
 	str = mHtmlLeft.ReplaceAllString(str, ">")