change to json encode
This commit is contained in:
parent
d57ebe7d59
commit
b476e72225
5
main.go
5
main.go
|
@ -86,10 +86,9 @@ func getDashboardItemInfoHandler() http.Handler {
|
||||||
idInt, _ := strconv.Atoi(idStr)
|
idInt, _ := strconv.Atoi(idStr)
|
||||||
for _, c := range captures {
|
for _, c := range captures {
|
||||||
if c.ID == idInt {
|
if c.ID == idInt {
|
||||||
json, _ := json.Marshal(c)
|
|
||||||
res.Header().Add("Content-Type", "application/json")
|
res.Header().Add("Content-Type", "application/json")
|
||||||
res.Write([]byte(json))
|
json.NewEncoder(res).Encode(c)
|
||||||
return
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue