ipn/localapi: don't indent status response

Doing indented JSON marshaling results in encoding/json
allocating an internal buffer, so even when encoding directly
to a writer, it still generates a lot of garbage.

Updates tailscale/corp#18514

Signed-off-by: Percy Wegmann <percy@tailscale.com>
This commit is contained in:
Percy Wegmann 2024-03-21 07:22:25 -05:00
parent 512fc0b502
commit c1029de875
No known key found for this signature in database
GPG Key ID: 29D8CDEB4C13D48B
1 changed files with 1 additions and 3 deletions

View File

@ -1202,9 +1202,7 @@ func (h *Handler) serveStatus(w http.ResponseWriter, r *http.Request) {
} else {
st = h.b.StatusWithoutPeers()
}
e := json.NewEncoder(w)
e.SetIndent("", "\t")
e.Encode(st)
json.NewEncoder(w).Encode(st)
}
func (h *Handler) serveDebugPeerEndpointChanges(w http.ResponseWriter, r *http.Request) {