-
Notifications
You must be signed in to change notification settings - Fork 672
Conversation
@squaremo mind taking a look at this? |
@@ -145,6 +145,11 @@ func handleHttp(router *weave.Router) { | |||
io.WriteString(w, fmt.Sprintln("Encryption", encryption)) | |||
io.WriteString(w, router.Status()) | |||
}) | |||
http.HandleFunc("/status-json", func(w http.ResponseWriter, r *http.Request) { | |||
w.Header().Set("Access-Control-Allow-Origin", "*") |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
What's the argument for using specialise methods rather than giving the struct definitions tags -- just that the data aren't quite organised in the right way? |
Taking the structs one at a time: |
@squaremo I added top-level version and encryption info |
Json generation is done by creating dummy structs and arrays that match the format we want, copying the information into them, then getting Go's standard json encoder to do the work.
All the implementation is pulled into one file json.go rather than scattering it across all the relevant implementations; at time of writing this seems easier to grasp.