package subsonic import ( "net/http" "github.com/mithral/vellum/internal/subsonic/dto" ) // writeJSONResponse writes the JSON envelope. func writeJSONResponse(w http.ResponseWriter, root *dto.Node) { w.Header().Set("Content-Type", "application/json; charset=utf-8") body, err := dto.JSONBody(root) if err != nil { return } _, _ = w.Write(body) } // writeXMLResponse writes the XML envelope, including the namespace the XSD // declares. func writeXMLResponse(w http.ResponseWriter, root *dto.Node) { w.Header().Set("Content-Type", "text/xml; charset=utf-8") _, _ = w.Write(dto.XMLBody(root)) }