~yerinalexey/gtranslate

e1c610caf977a9ae78c050accc268d9ed2995297 — Alexey Yerin a month ago b67c439
Move writeError to api.go

Web interface now uses error HTML template instead.
2 files changed, 5 insertions(+), 11 deletions(-)

M api.go
D utils.go
M api.go => api.go +5 -0
@@ 5,6 5,11 @@ import (
	"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) {
	return func(w http.ResponseWriter, req *http.Request) {
		from := req.FormValue("from")

D utils.go => utils.go +0 -11
@@ 1,11 0,0 @@
package main

import (
	"fmt"
	"net/http"
)

func writeError(w http.ResponseWriter, status int, err interface{}) {
	w.WriteHeader(status)
	fmt.Fprintln(w, err)
}