@@ -60,14 +60,23 @@ func (s *pullService) ListCommits(ctx context.Context, repo string, number int,
60
60
}
61
61
62
62
func (s * pullService ) Create (ctx context.Context , repo string , input * scm.PullRequestInput ) (* scm.PullRequest , * scm.Response , error ) {
63
- in := url.Values {}
64
- in .Set ("title" , input .Title )
65
- in .Set ("description" , input .Body )
66
- in .Set ("source_branch" , input .Source )
67
- in .Set ("target_branch" , input .Target )
68
- path := fmt .Sprintf ("api/v4/projects/%s/merge_requests?%s" , encode (repo ), in .Encode ())
63
+ // https://docs.gitlab.com/ee/api/merge_requests.html#create-mr
64
+ in := struct {
65
+ Title string `json:"title"`
66
+ Description string `json:"description"`
67
+ SourceBranch string `json:"source_branch"`
68
+ TargetBranch string `json:"target_branch"`
69
+ }{
70
+ Title : input .Title ,
71
+ Description : input .Body ,
72
+ SourceBranch : input .Source ,
73
+ TargetBranch : input .Target ,
74
+ }
75
+
76
+ path := fmt .Sprintf ("api/v4/projects/%s/merge_requests" , encode (repo ))
77
+
69
78
out := new (pr )
70
- res , err := s .client .do (ctx , "POST" , path , nil , out )
79
+ res , err := s .client .do (ctx , "POST" , path , in , out )
71
80
return convertPullRequest (out ), res , err
72
81
}
73
82
0 commit comments