From 0f20e50f8125c6b5cad99ccacfd2787d352e9eff Mon Sep 17 00:00:00 2001 From: Bo Shi Date: Tue, 17 May 2016 13:10:03 -0700 Subject: [PATCH 1/2] Content-Type must be set for some requests Against a 2.12.2 server, POST requests to SetReview fail unless this header is set. --- gerrit.go | 1 + 1 file changed, 1 insertion(+) diff --git a/gerrit.go b/gerrit.go index 29ee191..28bd10e 100644 --- a/gerrit.go +++ b/gerrit.go @@ -109,6 +109,7 @@ func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Requ // Request compact JSON // See https://gerrit-review.googlesource.com/Documentation/rest-api.html#output req.Header.Add("Accept", "application/json") + req.Header.Add("Content-Type", "application/json") // TODO: Add gzip encoding // Accept-Encoding request header is set to gzip From baf64dce6096f6d66c5e4bf1bc6c3c878216f6b4 Mon Sep 17 00:00:00 2001 From: Bo Shi Date: Tue, 17 May 2016 10:01:44 -0700 Subject: [PATCH 2/2] Bring ReviewInput up to date with 2.12.2 --- changes.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/changes.go b/changes.go index d690cdb..6798634 100644 --- a/changes.go +++ b/changes.go @@ -187,13 +187,15 @@ type ReviewerInput struct { // ReviewInput entity contains information for adding a review to a revision. type ReviewInput struct { - Message string `json:"message,omitempty"` - Labels map[string]string `json:"labels,omitempty"` - Comments map[string][]CommentInput `json:"comments,omitempty"` - StrictLabels bool `json:"strict_labels,omitempty"` - Drafts string `json:"drafts,omitempty"` - Notify string `json:"notify,omitempty"` - OnBehalfOf string `json:"on_behalf_of,omitempty"` + Message string `json:"message,omitempty"` + Tag string `json:"tag,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Comments map[string][]CommentInput `json:"comments,omitempty"` + StrictLabels bool `json:"strict_labels,omitempty"` + Drafts string `json:"drafts,omitempty"` + Notify string `json:"notify,omitempty"` + OmitDuplicateComments bool `json:"omit_duplicate_comments,omitempty"` + OnBehalfOf string `json:"on_behalf_of,omitempty"` } // RelatedChangeAndCommitInfo entity contains information about a related change and commit.