This commit is contained in:
deepzz0
2017-01-08 15:59:47 +08:00
parent 777dd86357
commit e626df3c22
3 changed files with 17 additions and 1 deletions

View File

@@ -159,7 +159,6 @@ func PostComment(pc *PostCreate) string {
return "" return ""
} }
request.Header.Set("Referer", "https://disqus.com") request.Header.Set("Referer", "https://disqus.com")
logd.Print(*request)
resp, err := http.DefaultClient.Do(request) resp, err := http.DefaultClient.Do(request)
if err != nil { if err != nil {
logd.Error(err) logd.Error(err)

View File

@@ -7,3 +7,19 @@ import (
func TestDisqus(t *testing.T) { func TestDisqus(t *testing.T) {
PostsCount() PostsCount()
} }
func TestPostComment(t *testing.T) {
pc := &PostCreate{
Message: "hahahaha",
Thread: "52799014",
AuthorEmail: "deepzz.qi@gmail.com",
AuthorName: "deepzz",
}
id := PostComment(pc)
if id == "" {
t.Error("post failed")
return
}
t.Log("post success")
}

View File

@@ -338,6 +338,7 @@ func HandleDisqusCreate(c *gin.Context) {
Thread: thread, Thread: thread,
AuthorEmail: email, AuthorEmail: email,
AuthorName: name, AuthorName: name,
Identifier: identifier,
IpAddress: c.ClientIP(), IpAddress: c.ClientIP(),
} }