@@ -550,8 +550,13 @@ func TestSetWebhookWithCert(t *testing.T) {
550550
551551 bot .Request (DeleteWebhookConfig {})
552552
553- wh := NewWebhookWithCert ("https://example.com/tgbotapi-test/" + bot .Token , "tests/cert.pem" )
554- _ , err := bot .Request (wh )
553+ wh , err := NewWebhookWithCert ("https://example.com/tgbotapi-test/" + bot .Token , "tests/cert.pem" )
554+
555+ if err != nil {
556+ t .Error (err )
557+ }
558+ _ , err = bot .Request (wh )
559+
555560 if err != nil {
556561 t .Error (err )
557562 }
@@ -572,8 +577,14 @@ func TestSetWebhookWithoutCert(t *testing.T) {
572577
573578 bot .Request (DeleteWebhookConfig {})
574579
575- wh := NewWebhook ("https://example.com/tgbotapi-test/" + bot .Token )
576- _ , err := bot .Request (wh )
580+ wh , err := NewWebhook ("https://example.com/tgbotapi-test/" + bot .Token )
581+
582+ if err != nil {
583+ t .Error (err )
584+ }
585+
586+ _ , err = bot .Request (wh )
587+
577588 if err != nil {
578589 t .Error (err )
579590 }
@@ -704,7 +715,14 @@ func ExampleNewWebhook() {
704715
705716 log .Printf ("Authorized on account %s" , bot .Self .UserName )
706717
707- _ , err = bot .Request (NewWebhookWithCert ("https://www.google.com:8443/" + bot .Token , "cert.pem" ))
718+ wh , err := NewWebhookWithCert ("https://www.google.com:8443/" + bot .Token , "cert.pem" )
719+
720+ if err != nil {
721+ panic (err )
722+ }
723+
724+ _ , err = bot .Request (wh )
725+
708726 if err != nil {
709727 panic (err )
710728 }
@@ -737,7 +755,13 @@ func ExampleWebhookHandler() {
737755
738756 log .Printf ("Authorized on account %s" , bot .Self .UserName )
739757
740- _ , err = bot .Request (NewWebhookWithCert ("https://www.google.com:8443/" + bot .Token , "cert.pem" ))
758+ wh , err := NewWebhookWithCert ("https://www.google.com:8443/" + bot .Token , "cert.pem" )
759+
760+ if err != nil {
761+ panic (err )
762+ }
763+
764+ _ , err = bot .Request (wh )
741765 if err != nil {
742766 panic (err )
743767 }
0 commit comments