Using context for HTTP requests
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
"github.com/qdm12/golibs/files"
|
||||
"github.com/qdm12/golibs/logging"
|
||||
"golang.org/x/net/context/ctxhttp"
|
||||
)
|
||||
|
||||
type piaV3 struct {
|
||||
@@ -89,7 +90,7 @@ func (p *piaV3) PortForward(ctx context.Context, client *http.Client,
|
||||
}
|
||||
clientID := hex.EncodeToString(b)
|
||||
url := fmt.Sprintf("%s/?client_id=%s", constants.PIAPortForwardURL, clientID)
|
||||
response, err := client.Get(url) // TODO add ctx
|
||||
response, err := ctxhttp.Get(ctx, client, url)
|
||||
if err != nil {
|
||||
pfLogger.Error(err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user