MechBoard/server/api/internal/http/http.go

23 lines
369 B
Go
Raw Permalink Normal View History

package http
import (
"io"
"log"
"net/http"
)
func Get(url string) (io.Reader, error) {
client := &http.Client{}
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Printf("[GET] err! :: %v", err)
return nil, err
}
res, err := client.Do(req)
if err != nil {
log.Printf("[GET] err! :: %v", err)
return nil, err
}
return res.Body, nil
}