12 lines
220 B
Go
12 lines
220 B
Go
package common
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
func SendError(w http.ResponseWriter, errStr string, statusCode int) {
|
|
w.WriteHeader(statusCode)
|
|
json.NewEncoder(w).Encode(map[string]string{"error": errStr})
|
|
}
|