How To Set Status Code Golang Http

[Solved] How To Set Status Code Golang Http | Erlang - Code Explorer | yomemimo.com
Question : how to set status code golang http

Answered by : restu-wahyu-saputra

func ServeHTTP(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusInternalServerError) w.Write([]byte("500 - Something bad happened!"))
}

Source : https://stackoverflow.com/questions/40096750/how-to-set-http-status-code-on-http-responsewriter | Last Update : Sat, 16 Oct 21

Question : how to set status code golang http

Answered by : restu-wahyu-saputra

rw.WriteHeader(http.StatusBadRequest)

Source : | Last Update : Sat, 16 Oct 21

Answers related to how to set status code golang http

Code Explorer Popular Question For Erlang