new packages
This commit is contained in:
parent
aa5ccaded0
commit
4f4e320999
8 changed files with 83 additions and 70 deletions
19
resp_err/resp_err.go
Normal file
19
resp_err/resp_err.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue