mirror of https://github.com/gin-gonic/gin.git
Merge branch 'master' of https://github.com/chad-russell/gin into chad-russell-master
This commit is contained in:
commit
c9809ab10d
20
gin.go
20
gin.go
|
@ -81,6 +81,26 @@ var (
|
|||
}
|
||||
)
|
||||
|
||||
// Allows type H to be used with xml.Marshal
|
||||
func (h H) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
|
||||
if err := e.EncodeToken(start); err != nil {
|
||||
return err
|
||||
}
|
||||
for key, value := range h {
|
||||
elem := xml.StartElement{
|
||||
xml.Name{"", key},
|
||||
[]xml.Attr{},
|
||||
}
|
||||
if err = e.EncodeElement(value, elem); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err = e.EncodeToken(xml.EndElement{start.Name}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a ErrorMsgs) String() string {
|
||||
var buffer bytes.Buffer
|
||||
for i, msg := range a {
|
||||
|
|
Loading…
Reference in New Issue