完善评论
This commit is contained in:
parent
67b48b36a8
commit
4ceafe9c5f
@ -31,7 +31,9 @@ func PostComment(c *gin.Context) {
|
|||||||
data, err := c.GetRawData()
|
data, err := c.GetRawData()
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.String(http.StatusConflict, err.Error())
|
c.Writer.WriteHeader(http.StatusConflict)
|
||||||
|
c.Writer.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||||
|
c.Writer.WriteString(err.Error())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -49,6 +51,11 @@ func PostComment(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
defer req.Body.Close()
|
defer req.Body.Close()
|
||||||
req.Header = c.Request.Header.Clone()
|
req.Header = c.Request.Header.Clone()
|
||||||
|
home, err := url.Parse(wp.Option["siteurl"])
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
req.Host = home.Host
|
||||||
res, err := cli.Do(req)
|
res, err := cli.Do(req)
|
||||||
if err != nil && err != http.ErrUseLastResponse {
|
if err != nil && err != http.ErrUseLastResponse {
|
||||||
return
|
return
|
||||||
@ -67,8 +74,12 @@ func PostComment(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
up.Host = cu.Host
|
up.Host = cu.Host
|
||||||
|
newReq, err := http.NewRequest("GET", up.String(), nil)
|
||||||
ress, err := http.DefaultClient.Get(up.String())
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
newReq.Host = home.Host
|
||||||
|
ress, err := http.DefaultClient.Do(newReq)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user