added request body reader

This commit is contained in:
Altair-sh
2026-11-04 02:42:30 +01:00
parent 793cbcc37f
commit 59f7d873be
10 changed files with 283 additions and 150 deletions
+27
View File
@@ -0,0 +1,27 @@
package html
import sh "serveg/internal/string_helper"
const DateTimeTZ = "2006-01-02 15:04:05 UTC-07"
func htmlEscape(s string) string {
sb := sh.StringBuilder{Buf: make([]byte, 0, len(s))}
for i := 0; i < len(s); i++ {
b := s[i]
switch b {
case '&':
sb.AddS("&amp;")
case '<':
sb.AddS("&lt;")
case '>':
sb.AddS("&gt;")
case '"':
sb.AddS("&quot;")
case '\'':
sb.AddS("&#39;")
default:
sb.AddB(b)
}
}
return sb.StringUnsafe()
}