mirror of https://github.com/gin-gonic/gin.git
Fixes MarshalXML() and renames initial "H" tag to "map".
This commit is contained in:
parent
c9809ab10d
commit
f8d85c1b4d
5
gin.go
5
gin.go
|
@ -83,6 +83,7 @@ var (
|
|||
|
||||
// Allows type H to be used with xml.Marshal
|
||||
func (h H) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
|
||||
start.Name = xml.Name{"", "map"}
|
||||
if err := e.EncodeToken(start); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -91,11 +92,11 @@ func (h H) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
|
|||
xml.Name{"", key},
|
||||
[]xml.Attr{},
|
||||
}
|
||||
if err = e.EncodeElement(value, elem); err != nil {
|
||||
if err := e.EncodeElement(value, elem); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err = e.EncodeToken(xml.EndElement{start.Name}); err != nil {
|
||||
if err := e.EncodeToken(xml.EndElement{start.Name}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue