I'm writing a simple server as a project to help me learn Go. Here's its minimal form:
package main
import (
    "io"
    "net/http"
)
func serve(w http.ResponseWriter, r *http.Request) {
    text := "HTTP/1.1 200 OK\r\n" +
    "Content-Type: text/html\r\n" + 
    "Host: localhost:1234\r\n" + 
    "Connection: close\r\n" + 
    "\r\n" + 
    "<!doctype html>\r\n" + 
    "<html>...</html>\r\n"
    // Greet the user, ignoring their request.
    io.WriteString(w, text)
}
func main() {
    http.HandleFunc("/", serve)
    http.ListenAndServe(":1234", nil)
}
It works as expected in terms that it sends the desired text when a client connects to localhost:1234. But for some reason my browser displays the output as text instead of HTML, as desired. What am I doing wrong?