19 lines
479 B
Go
19 lines
479 B
Go
package resp_err
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
func Write(w http.ResponseWriter) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(http.StatusOK)
|
|
jsonData := []byte(`{"status":"ERROR","reason":"bad request"}`)
|
|
w.Write(jsonData)
|
|
}
|
|
|
|
func Write_message(w http.ResponseWriter, message string) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(http.StatusOK)
|
|
jsonData := []byte(`{"status":"ERROR","reason":"` + message + `"}`)
|
|
w.Write(jsonData)
|
|
}
|