From f6c0a9d870be97d0dd360952abadb0f2cabae911 Mon Sep 17 00:00:00 2001 From: Baraa Al-Masri Date: Thu, 4 Jan 2024 23:04:35 +0300 Subject: [PATCH] cOnTeNt TyPe & cOrS --- images.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/images.go b/images.go index 580b0b8..735fb1a 100644 --- a/images.go +++ b/images.go @@ -59,6 +59,8 @@ func handleGetImage(w http.ResponseWriter, r *http.Request) { for i := 1; i < int(math.Min(float64(count), float64(len(imagesPaths)))); i++ { images = append(images, getRandomImage(orientation)) } + w.Header().Set("Content-Type", "application/json") + w.Header().Set("Access-Control-Allow-Origin", "*") _ = json.NewEncoder(w).Encode(map[string]any{ "images": images, })