@@ -479,8 +479,13 @@ func TestSetWebhookWithCert(t *testing.T) {
479479
480480 bot .Request (RemoveWebhookConfig {})
481481
482- wh := NewWebhookWithCert ("https://example.com/tgbotapi-test/" + bot .Token , "tests/cert.pem" )
483- _ , err := bot .Request (wh )
482+ wh , err := NewWebhookWithCert ("https://example.com/tgbotapi-test/" + bot .Token , "tests/cert.pem" )
483+
484+ if err != nil {
485+ t .Error (err )
486+ }
487+ _ , err = bot .Request (wh )
488+
484489 if err != nil {
485490 t .Error (err )
486491 }
@@ -501,8 +506,14 @@ func TestSetWebhookWithoutCert(t *testing.T) {
501506
502507 bot .Request (RemoveWebhookConfig {})
503508
504- wh := NewWebhook ("https://example.com/tgbotapi-test/" + bot .Token )
505- _ , err := bot .Request (wh )
509+ wh , err := NewWebhook ("https://example.com/tgbotapi-test/" + bot .Token )
510+
511+ if err != nil {
512+ t .Error (err )
513+ }
514+
515+ _ , err = bot .Request (wh )
516+
506517 if err != nil {
507518 t .Error (err )
508519 }
@@ -589,7 +600,14 @@ func ExampleNewWebhook() {
589600
590601 log .Printf ("Authorized on account %s" , bot .Self .UserName )
591602
592- _ , err = bot .Request (NewWebhookWithCert ("https://www.google.com:8443/" + bot .Token , "cert.pem" ))
603+ wh , err := NewWebhookWithCert ("https://www.google.com:8443/" + bot .Token , "cert.pem" )
604+
605+ if err != nil {
606+ panic (err )
607+ }
608+
609+ _ , err = bot .Request (wh )
610+
593611 if err != nil {
594612 panic (err )
595613 }
@@ -622,7 +640,13 @@ func ExampleWebhookHandler() {
622640
623641 log .Printf ("Authorized on account %s" , bot .Self .UserName )
624642
625- _ , err = bot .Request (NewWebhookWithCert ("https://www.google.com:8443/" + bot .Token , "cert.pem" ))
643+ wh , err := NewWebhookWithCert ("https://www.google.com:8443/" + bot .Token , "cert.pem" )
644+
645+ if err != nil {
646+ panic (err )
647+ }
648+
649+ _ , err = bot .Request (wh )
626650 if err != nil {
627651 panic (err )
628652 }
0 commit comments