Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func ServeHTTP(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusInternalServerError)
- w.Write([]byte("500 - Something bad happened!"))
- }
- func yourFuncHandler(w http.ResponseWriter, r *http.Request) {
- http.Error(w, "my own error message", http.StatusForbidden)
- // or using the default message error
- http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
- }
- w.WriteHeader(http.StatusInternalServerError)
- w.WriteHeader(http.StatusForbidden)
Add Comment
Please, Sign In to add comment