Answers for "status in golang rest api"

Go
0

how to set status code golang http

func ServeHTTP(w http.ResponseWriter, r *http.Request) {
    w.WriteHeader(http.StatusInternalServerError)
    w.Write([]byte("500 - Something bad happened!"))
}
Posted by: Guest on October-09-2021
0

how to set status code golang http

rw.WriteHeader(http.StatusBadRequest)
Posted by: Guest on October-09-2021

Browse Popular Code Answers by Language