Simplified sending HTMX

This commit is contained in:
Caleb Gardner
2024-11-01 11:46:07 -05:00
parent 6925ff9e0c
commit 0f2b0f4f5d
4 changed files with 12 additions and 21 deletions
+2 -6
View File
@@ -21,7 +21,7 @@ func filesRequest(w http.ResponseWriter, r *http.Request) {
if err != nil {
if os.IsNotExist(err) {
pageContent = "<p>404 Not Found</p>"
// w.WriteHeader(http.StatusNotFound)
w.WriteHeader(http.StatusNotFound)
} else {
pageContent = "<p>Server error!</p>"
w.WriteHeader(http.StatusInternalServerError)
@@ -52,9 +52,5 @@ func filesRequest(w http.ResponseWriter, r *http.Request) {
return
}
}
if r.Header.Get("Hx-Request") == "true" {
w.Write([]byte(pageContent))
} else {
sendContent(w, r, pageContent, "Files", "")
}
sendContent(w, r, pageContent, "Files", "")
}