Commit 2a43c0fd authored by Aksel Baardsen's avatar Aksel Baardsen
Browse files

Added comments

parent 02913859
...@@ -27,6 +27,6 @@ func Chandler(w http.ResponseWriter, r *http.Request) { ...@@ -27,6 +27,6 @@ func Chandler(w http.ResponseWriter, r *http.Request) {
} }
} else { } else {
// need to check error for content when setting header (pkg.CorrectHeader) // need to check error for content when setting header (pkg.CorrectHeader)
http.Error(w, "An error occured", pkg.CorrectHeader(err)) http.Error(w, "An error occurred", pkg.CorrectHeader(err))
} }
} }
...@@ -11,7 +11,7 @@ func Dhandler(w http.ResponseWriter, r *http.Request) { ...@@ -11,7 +11,7 @@ func Dhandler(w http.ResponseWriter, r *http.Request) {
var diagnostics pkg.Diag var diagnostics pkg.Diag
if err := pkg.GetDiag(&diagnostics); err != nil { if err := pkg.GetDiag(&diagnostics); err != nil {
http.Error(w, "An error occured", http.StatusBadGateway) http.Error(w, "An error occurred", http.StatusBadGateway)
} }
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
......
...@@ -21,6 +21,6 @@ func Shandler(w http.ResponseWriter, r *http.Request) { ...@@ -21,6 +21,6 @@ func Shandler(w http.ResponseWriter, r *http.Request) {
} }
} else { } else {
w.WriteHeader(pkg.CorrectHeader(err)) w.WriteHeader(pkg.CorrectHeader(err))
_, _ = fmt.Fprintln(w, "An error occured") _, _ = fmt.Fprintln(w, "An error occurred")
} }
} }
...@@ -36,6 +36,7 @@ func GetDiag(d* Diag) error { ...@@ -36,6 +36,7 @@ func GetDiag(d* Diag) error {
return nil return nil
} }
// Gets GBIF-api status code
func getGbifStatus(d *Diag) error { func getGbifStatus(d *Diag) error {
resp, err := http.Get(gbifApi) resp, err := http.Get(gbifApi)
if err != nil { if err != nil {
...@@ -45,6 +46,7 @@ func getGbifStatus(d *Diag) error { ...@@ -45,6 +46,7 @@ func getGbifStatus(d *Diag) error {
return nil return nil
} }
// Gets country-api status code
func getRestStatus(d *Diag) error { func getRestStatus(d *Diag) error {
resp, err := http.Get(restApi) resp, err := http.Get(restApi)
if err != nil { if err != nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment