Skip to content

Commit

Permalink
feat(disable ssl): Add description on disabling ssl verification
Browse files Browse the repository at this point in the history
  • Loading branch information
ehdsouza committed Sep 19, 2019
1 parent 7cfc1cc commit 298ec08
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/base_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ import (
)

const (
header_name_USER_AGENT = "User-Agent"
sdk_name = "ibm-go-sdk-core"
header_name_USER_AGENT = "User-Agent"
sdk_name = "ibm-go-sdk-core"
ERROR_MSG_DISABLE_SSL = "If you're trying to call a service on ICP or Cloud Pak for Data, you may not have a valid SSL certificate. If you need to access the service without setting that up, try using the DisableSSLVerification option in your authentication configuration and/or calling DisableSSLVerification() on your service."
SSL_CERTIFICATION_ERROR = "x509: certificate"
)

// ServiceOptions : This struct contains the options supported by the BaseService methods.
Expand Down Expand Up @@ -206,6 +208,9 @@ func (service *BaseService) Request(req *http.Request, result interface{}) (deta
// Invoke the request.
httpResponse, err := service.Client.Do(req)
if err != nil {
if strings.Contains(err.Error(), SSL_CERTIFICATION_ERROR) {
err = fmt.Errorf(ERROR_MSG_DISABLE_SSL + "\n" + err.Error())
}
return
}

Expand Down

0 comments on commit 298ec08

Please sign in to comment.