fixed weird xml string
This commit is contained in:
@@ -77,12 +77,11 @@ func (bc *BlogController) RSSFeed(c *gin.Context) {
|
|||||||
c.HTML(http.StatusInternalServerError, "internal_server_error", &gin.H{})
|
c.HTML(http.StatusInternalServerError, "internal_server_error", &gin.H{})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.Header("Content-Type", "text/xml")
|
|
||||||
var rawXml bytes.Buffer
|
var rawXml bytes.Buffer
|
||||||
err = t.Execute(&rawXml, posts)
|
err = t.Execute(&rawXml, posts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.HTML(http.StatusInternalServerError, "internal_server_error", &gin.H{})
|
c.HTML(http.StatusInternalServerError, "internal_server_error", &gin.H{})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.String(http.StatusOK, strings.Replace(rawXml.String(), "&", "&", -1), &gin.H{})
|
c.Data(http.StatusOK, "text/xml", []byte(strings.Replace("&", "&", rawXml.String(), -1)))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user