To return/send an HTTP error in Go, you can use a methods from a standard library that writes to a writer and passes the error code as well as the message.
http.Error(w, "Message", http.StatusMethodNotAllowed) To return/send an HTTP error in Go, you can use a methods from a standard library that writes to a writer and passes the error code as well as the message.
http.Error(w, "Message", http.StatusMethodNotAllowed)