diff options
Diffstat (limited to 'vendor/github.com/google/go-github/github/github.go')
-rw-r--r-- | vendor/github.com/google/go-github/github/github.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/vendor/github.com/google/go-github/github/github.go b/vendor/github.com/google/go-github/github/github.go index 3d7421f..a58dbfb 100644 --- a/vendor/github.com/google/go-github/github/github.go +++ b/vendor/github.com/google/go-github/github/github.go @@ -85,14 +85,20 @@ const ( // https://developer.github.com/changes/2016-07-06-github-pages-preiew-api/ mediaTypePagesPreview = "application/vnd.github.mister-fantastic-preview+json" - // https://developer.github.com/v3/repos/traffic/ - mediaTypeTrafficPreview = "application/vnd.github.spiderman-preview+json" - // https://developer.github.com/changes/2016-09-14-projects-api/ mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json" // https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/ mediaTypeIntegrationPreview = "application/vnd.github.machine-man-preview+json" + + // https://developer.github.com/changes/2016-11-28-preview-org-membership/ + mediaTypeOrgMembershipPreview = "application/vnd.github.korra-preview+json" + + // https://developer.github.com/changes/2017-01-05-commit-search-api/ + mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview+json" + + // https://developer.github.com/changes/2016-12-14-reviews-api/ + mediaTypePullRequestReviewsPreview = "application/vnd.github.black-cat-preview+json" ) // A Client manages communication with the GitHub API. @@ -406,6 +412,12 @@ func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) { resp, err := c.client.Do(req) if err != nil { + if e, ok := err.(*url.Error); ok { + if url, err := url.Parse(e.URL); err == nil { + e.URL = sanitizeURL(url).String() + return nil, e + } + } return nil, err } @@ -550,7 +562,7 @@ func (r *AbuseRateLimitError) Error() string { } // sanitizeURL redacts the client_secret parameter from the URL which may be -// exposed to the user, specifically in the ErrorResponse error message. +// exposed to the user. func sanitizeURL(uri *url.URL) *url.URL { if uri == nil { return nil |