Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Use http.DefaultClient with a timeout #31

Merged
merged 1 commit into from
Jan 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion domain/token/token_retriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"io/ioutil"
"net/http"
"net/url"
"time"

"github.com/fabric8-services/build-tool-detector/log"
client "github.com/fabric8-services/fabric8-auth-client/auth"
Expand Down Expand Up @@ -68,7 +69,11 @@ func GetGitHubToken(ctx *context.Context, authServiceURL string, u *url.URL) (*s
if err != nil {
return nil, errors.Wrap(err, "auth service url not found")
}
authClient := client.New(goaclient.HTTPClientDoer(http.DefaultClient))
defaultClient := http.DefaultClient
// The default client doesn't have a timeout. Explicitly set one so that we
// don't wait indefinitely
defaultClient.Timeout = 15 * time.Second
authClient := client.New(goaclient.HTTPClientDoer(defaultClient))
authClient.Host = url.Host
authClient.Scheme = url.Scheme
if goajwt.ContextJWT(*ctx) != nil {
Expand Down