This commit is contained in:
Bolke de Bruin 2020-07-21 19:53:54 +02:00
parent 9cd40d5b30
commit 0f2696ec8b

21
http.go
View file

@ -1,21 +0,0 @@
package main
import (
"net/http"
"strconv"
)
const (
HttpOK = "HTTP/1.1 200 OK\r\n"
MethodRDGIN = "RDG_IN_DATA"
MethodRDGOUT = "RDG_OUT_DATA"
)
// httpError is like the http.Error with WebSocket context exception.
func httpError(w http.ResponseWriter, body string, code int) {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.Header().Set("Content-Length", strconv.Itoa(len(body)))
w.WriteHeader(code)
w.Write([]byte(body))
}