Attempt to fix content-length header in index (#159)

pull/160/head
Jeff Mitchell 6 years ago committed by GitHub
parent 9a1539867e
commit c965cf1bc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,7 @@ package controller
import (
"bytes"
"fmt"
"net/http"
"strings"
)
@ -42,10 +43,8 @@ func (i *indexResponseWriter) writeToWriter(w http.ResponseWriter) {
w.Header().Add(k, h)
}
}
newBody := []byte(strings.Replace(i.body.String(), magicValue, i.defaultOrgId, 1))
w.Header().Set("content-length", fmt.Sprintf("%d", len(newBody)))
w.WriteHeader(i.statusCode)
w.Write(
[]byte(
strings.Replace(i.body.String(), magicValue, i.defaultOrgId, 1),
),
)
w.Write(newBody)
}

Loading…
Cancel
Save