evcc-io/util/request/xml.go
2025-10-31 15:25:53 +00:00

21 lines
303 B
Go

package request
import (
"bytes"
"encoding/xml"
"io"
)
// MarshalXML marshals XML into an io.ReadSeeker
func MarshalXML(data any) io.ReadSeeker {
if data == nil {
return nil
}
body, err := xml.Marshal(data)
if err != nil {
return &errorReader{err: err}
}
return bytes.NewReader(body)
}