Move writeError to api.go
Web interface now uses error HTML template instead.
This commit is contained in:
parent
b67c4398fc
commit
e1c610caf9
5
api.go
5
api.go
|
@ -5,6 +5,11 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func writeError(w http.ResponseWriter, status int, err interface{}) {
|
||||||
|
w.WriteHeader(status)
|
||||||
|
fmt.Fprintln(w, err)
|
||||||
|
}
|
||||||
|
|
||||||
func CreateApiHandler(settings *TranslateSettings) func(w http.ResponseWriter, req *http.Request) {
|
func CreateApiHandler(settings *TranslateSettings) func(w http.ResponseWriter, req *http.Request) {
|
||||||
return func(w http.ResponseWriter, req *http.Request) {
|
return func(w http.ResponseWriter, req *http.Request) {
|
||||||
from := req.FormValue("from")
|
from := req.FormValue("from")
|
||||||
|
|
Loading…
Reference in New Issue