Remove deprecated ioutil functions
parent
537c005643
commit
2cc6dc2458
3
bot.go
3
bot.go
|
@ -7,7 +7,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -151,7 +150,7 @@ func (bot *BotAPI) decodeAPIResponse(responseBody io.Reader, resp *APIResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if debug, read response body
|
// if debug, read response body
|
||||||
data, err := ioutil.ReadAll(responseBody)
|
data, err := io.ReadAll(responseBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package tgbotapi
|
package tgbotapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -139,7 +138,7 @@ func TestSendWithNewPhoto(t *testing.T) {
|
||||||
func TestSendWithNewPhotoWithFileBytes(t *testing.T) {
|
func TestSendWithNewPhotoWithFileBytes(t *testing.T) {
|
||||||
bot, _ := getBot(t)
|
bot, _ := getBot(t)
|
||||||
|
|
||||||
data, _ := ioutil.ReadFile("tests/image.jpg")
|
data, _ := os.ReadFile("tests/image.jpg")
|
||||||
b := FileBytes{Name: "image.jpg", Bytes: data}
|
b := FileBytes{Name: "image.jpg", Bytes: data}
|
||||||
|
|
||||||
msg := NewPhoto(ChatID, b)
|
msg := NewPhoto(ChatID, b)
|
||||||
|
@ -195,7 +194,7 @@ func TestSendNewPhotoToChannel(t *testing.T) {
|
||||||
func TestSendNewPhotoToChannelFileBytes(t *testing.T) {
|
func TestSendNewPhotoToChannelFileBytes(t *testing.T) {
|
||||||
bot, _ := getBot(t)
|
bot, _ := getBot(t)
|
||||||
|
|
||||||
data, _ := ioutil.ReadFile("tests/image.jpg")
|
data, _ := os.ReadFile("tests/image.jpg")
|
||||||
b := FileBytes{Name: "image.jpg", Bytes: data}
|
b := FileBytes{Name: "image.jpg", Bytes: data}
|
||||||
|
|
||||||
msg := NewPhotoToChannel(Channel, b)
|
msg := NewPhotoToChannel(Channel, b)
|
||||||
|
|
Loading…
Reference in New Issue