MCPcopy
hub / github.com/tinode/chat / serve404

Function serve404

server/http.go:212–223  ·  view source on GitHub ↗

Custom 404 response.

(wrt http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

210
211// Custom 404 response.
212func serve404(wrt http.ResponseWriter, req *http.Request) {
213 wrt.Header().Set("Content-Type", "application/json; charset=utf-8")
214 wrt.WriteHeader(http.StatusNotFound)
215 json.NewEncoder(wrt).Encode(
216 &ServerComMessage{
217 Ctrl: &MsgServerCtrl{
218 Timestamp: time.Now().UTC().Round(time.Millisecond),
219 Code: http.StatusNotFound,
220 Text: "not found",
221 },
222 })
223}
224
225// Redirect HTTP requests to HTTPS
226func tlsRedirect(toPort string) http.HandlerFunc {

Callers

nothing calls this directly

Calls 1

WriteHeaderMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…