15 lines
346 B
Go
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"))
|
|
}
|