photoprism/cmd/tensorflowapi/utilities.go
2018-02-04 17:34:07 +01:00

17 lines
No EOL
412 B
Go

package main
import (
"encoding/json"
"net/http"
)
func responseError(w http.ResponseWriter, message string, code int) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(code)
json.NewEncoder(w).Encode(map[string]string{"error": message})
}
func responseJSON(w http.ResponseWriter, data interface{}) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
}