Stop returning useless http.Handler from ListenForWebhook.
This commit is contained in:
parent
08d7c01637
commit
80e30d7c19
3 changed files with 5 additions and 23 deletions
18
bot_test.go
18
bot_test.go
|
@ -5,9 +5,7 @@ import (
|
|||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
@ -351,20 +349,6 @@ func TestGetUserProfilePhotos(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestListenForWebhook(t *testing.T) {
|
||||
bot, _ := getBot(t)
|
||||
|
||||
_, handler := bot.ListenForWebhook("/")
|
||||
|
||||
req, _ := http.NewRequest("GET", "", strings.NewReader("{}"))
|
||||
w := httptest.NewRecorder()
|
||||
|
||||
handler.ServeHTTP(w, req)
|
||||
if w.Code != http.StatusOK {
|
||||
t.Errorf("Home page didn't return %v", http.StatusOK)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetWebhookWithCert(t *testing.T) {
|
||||
bot, _ := getBot(t)
|
||||
|
||||
|
@ -445,7 +429,7 @@ func ExampleNewWebhook() {
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
updates, _ := bot.ListenForWebhook("/" + bot.Token)
|
||||
updates := bot.ListenForWebhook("/" + bot.Token)
|
||||
go http.ListenAndServeTLS("0.0.0.0:8443", "cert.pem", "key.pem", nil)
|
||||
|
||||
for update := range updates {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue