Skip to content

Commit 60fc2cc

Browse files
committed
Force JSON content type
1 parent d6ddc70 commit 60fc2cc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

contrib/proxyprobe/server/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ func handleHTTP(w http.ResponseWriter, r *http.Request) {
286286
}
287287

288288
body, err := io.ReadAll(r.Body)
289+
defer r.Body.Close()
289290
if err != nil {
290291
log.Printf("[ERROR] Failed to read request body from %s: %v", r.RemoteAddr, err)
291292
http.Error(w, "Failed to read request body", http.StatusInternalServerError)
@@ -302,6 +303,7 @@ func handleHTTP(w http.ResponseWriter, r *http.Request) {
302303
debugLog("Found matching response")
303304
}
304305

306+
w.Header().Set("Content-Type", "application/json")
305307
_, err = w.Write(response)
306308
if err != nil {
307309
log.Printf("[ERROR] Failed to write response to %s: %v", r.RemoteAddr, err)

0 commit comments

Comments
 (0)