fix security issues
This commit is contained in:
7
json.go
7
json.go
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
@@ -30,5 +31,9 @@ func respondWithJSON(w http.ResponseWriter, code int, payload interface{}) {
|
||||
return
|
||||
}
|
||||
w.WriteHeader(code)
|
||||
w.Write(dat)
|
||||
_, err = w.Write(dat)
|
||||
if err != nil {
|
||||
fmt.Printf("Error wiring response: %s", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user