diff --git a/main.go b/main.go index 490b7ee..0b60c73 100644 --- a/main.go +++ b/main.go @@ -18,12 +18,18 @@ type Metadata struct { func PipelineHandler(pipeline pipelines.IPipeline, w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") - json.NewEncoder(w).Encode(pipeline) + err := json.NewEncoder(w).Encode(pipeline) + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + } } func IndexHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") - json.NewEncoder(w).Encode(Metadata{Name, Version}) + err := json.NewEncoder(w).Encode(Metadata{Name, Version}) + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + } } func RegisterPipelineRoutes(r *mux.Router, pipelines []pipelines.IPipeline) { @@ -42,5 +48,8 @@ func main() { RegisterPipelineRoutes(r, pipes) - http.ListenAndServe(":8000", r) + err := http.ListenAndServe(":8000", r) + if err != nil { + panic(err) + } }