Files
http-server/response_helper/response_helper.go
2026-02-15 15:22:10 +01:00

15 lines
346 B
Go

package response_helper
import (
"fmt"
"net"
"net/http"
)
func RespondWithStatusCode(statusCode int, conn net.Conn) {
conn.Write([]byte(fmt.Sprintf("HTTP/1.1 %d %s\r\n", statusCode, http.StatusText(statusCode))))
conn.Write([]byte("Content-Type: text/plain\r\n"))
conn.Write([]byte("Content-Length: 0\r\n"))
conn.Write([]byte("\r\n"))
}