internal: add IsRequestEmpty

This commit is contained in:
Simon Ser
2024-02-07 17:22:41 +01:00
parent 71bd967b43
commit f1d56f2437
2 changed files with 7 additions and 8 deletions

View File

@@ -44,6 +44,11 @@ func DecodeXMLRequest(r *http.Request, v interface{}) error {
return nil
}
func IsRequestBodyEmpty(r *http.Request) bool {
_, err := r.Body.Read(nil)
return err == io.EOF
}
func ServeXML(w http.ResponseWriter) *xml.Encoder {
w.Header().Add("Content-Type", "text/xml; charset=\"utf-8\"")
w.Write([]byte(xml.Header))