SendJSON returns a simple JSON document.
(rw http.ResponseWriter, r *http.Request)
| 13 | |
| 14 | // SendJSON returns a simple JSON document. |
| 15 | func SendJSON(rw http.ResponseWriter, r *http.Request) { |
| 16 | u := struct { |
| 17 | Name string |
| 18 | Email string |
| 19 | }{ |
| 20 | Name: "Bill", |
| 21 | Email: "bill@ardanstudios.com", |
| 22 | } |
| 23 | |
| 24 | rw.Header().Set("Content-Type", "application/json") |
| 25 | rw.WriteHeader(200) |
| 26 | json.NewEncoder(rw).Encode(&u) |
| 27 | } |
nothing calls this directly
no outgoing calls
no test coverage detected