attach content length as well

This commit is contained in:
b1ek 2024-07-26 17:00:04 +10:00
parent 403549ed26
commit 506272e290
1 changed files with 2 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import (
"io" "io"
"net/http" "net/http"
"os" "os"
"strconv"
_ "embed" _ "embed"
) )
@ -27,6 +28,7 @@ func SendIndex(wr http.ResponseWriter, req *http.Request) {
} }
resp.Header = http.Header{} resp.Header = http.Header{}
resp.Header.Add("Content-Type", "text/html") resp.Header.Add("Content-Type", "text/html")
resp.Header.Add("Content-Length", strconv.Itoa(len(index)))
resp.Header.Add("Server", "astra") resp.Header.Add("Server", "astra")
req.Response = &resp req.Response = &resp
copyHeader(wr.Header(), resp.Header) copyHeader(wr.Header(), resp.Header)