From 1ee11e5972575f291558c46d04daca566b2845cd Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Fri, 18 Sep 2015 21:16:12 +0900 Subject: [PATCH] Fix incorrect URLs for milestone APIs API URLs starting with "/" does not play well with Github Enterprise, whose API endpoint looks like "http(s)://hostname/api/v3/". This fixes incorrect URLs in miletones APIs. --- github/issues_milestones.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github/issues_milestones.go b/github/issues_milestones.go index d5fd8ae..cbd7920 100644 --- a/github/issues_milestones.go +++ b/github/issues_milestones.go @@ -49,7 +49,7 @@ type MilestoneListOptions struct { // // GitHub API docs: https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository func (s *IssuesService) ListMilestones(owner string, repo string, opt *MilestoneListOptions) ([]Milestone, *Response, error) { - u := fmt.Sprintf("/repos/%v/%v/milestones", owner, repo) + u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) u, err := addOptions(u, opt) if err != nil { return nil, nil, err @@ -73,7 +73,7 @@ func (s *IssuesService) ListMilestones(owner string, repo string, opt *Milestone // // GitHub API docs: https://developer.github.com/v3/issues/milestones/#get-a-single-milestone func (s *IssuesService) GetMilestone(owner string, repo string, number int) (*Milestone, *Response, error) { - u := fmt.Sprintf("/repos/%v/%v/milestones/%d", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -92,7 +92,7 @@ func (s *IssuesService) GetMilestone(owner string, repo string, number int) (*Mi // // GitHub API docs: https://developer.github.com/v3/issues/milestones/#create-a-milestone func (s *IssuesService) CreateMilestone(owner string, repo string, milestone *Milestone) (*Milestone, *Response, error) { - u := fmt.Sprintf("/repos/%v/%v/milestones", owner, repo) + u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) req, err := s.client.NewRequest("POST", u, milestone) if err != nil { return nil, nil, err