mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 14:14:02 +03:00
Refactor firehol
This commit is contained in:
@@ -22,7 +22,7 @@ func (h httpFile) Open(ctx context.Context) (io.ReadCloser, error) {
|
||||
response, err := h.http.Do(request)
|
||||
if err != nil {
|
||||
if response != nil {
|
||||
io.Copy(io.Discard, response.Body)
|
||||
io.Copy(io.Discard, response.Body) // nolint: errcheck
|
||||
response.Body.Close()
|
||||
}
|
||||
|
||||
@@ -36,6 +36,10 @@ func (h httpFile) Open(ctx context.Context) (io.ReadCloser, error) {
|
||||
return response.Body, nil
|
||||
}
|
||||
|
||||
func (h httpFile) String() string {
|
||||
return h.url
|
||||
}
|
||||
|
||||
func NewHTTP(client *http.Client, endpoint string) (File, error) {
|
||||
if client == nil {
|
||||
return nil, ErrBadHTTPClient
|
||||
|
||||
Reference in New Issue
Block a user