From 0c9e1d2e22c597f6f5ef27ff6d07f57fc3428699 Mon Sep 17 00:00:00 2001 From: WimdeJager Date: Wed, 2 Jun 2021 17:21:01 +0200 Subject: [PATCH] Fix invalid json response The response was missing quotes around the JSON field names, so it was invalid JSON. This fixes that :) --- clamrest.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clamrest.go b/clamrest.go index 43aa1b3..27890f9 100644 --- a/clamrest.go +++ b/clamrest.go @@ -113,7 +113,7 @@ func scanHandler(w http.ResponseWriter, r *http.Request) { response, err := c.ScanStream(part, abort) for s := range response { w.Header().Set("Content-Type", "application/json; charset=utf-8") - respJson := fmt.Sprintf("{ Status: \"%s\", Description: \"%s\" }", s.Status, s.Description) + respJson := fmt.Sprintf("{ \"Status\": \"%s\", \"Description\": \"%s\" }", s.Status, s.Description) switch s.Status { case clamd.RES_OK: w.WriteHeader(http.StatusOK)