Closed wwade closed 3 years ago
I have a patch in hand and will submit a PR shortly:
--- a/go-gerrit/projects.go 2021-09-08 19:04:43.850861477 -0700
+++ b/go-gerrit/projects.go 2021-09-08 19:21:12.533485144 -0700
@@ -37,7 +37,7 @@
Owners []string `json:"owners,omitempty"`
- UseContributorAgreements string `json:"use_contributor_agreements"`
- UseSignedOffBy string `json:"use_signed_off_by"`
- CreateNewChangeForAllNotInTarget string `json:"create_new_change_for_all_not_in_target"`
- UseContentMerge string `json:"use_content_merge"`
- RequireChangeID string `json:"require_change_id"`
+ UseContributorAgreements string `json:"use_contributor_agreements,omitempty"`
+ UseSignedOffBy string `json:"use_signed_off_by,omitempty"`
+ CreateNewChangeForAllNotInTarget string `json:"create_new_change_for_all_not_in_target,omitempty"`
+ UseContentMerge string `json:"use_content_merge,omitempty"`
+ RequireChangeID string `json:"require_change_id,omitempty"`
MaxObjectSizeLimit string `json:"max_object_size_limit,omitempty"`
Hey @wwade, thanks for reporting the issue. I have two questions:
localhost
is 192.168.208.1, a local docker bridge network host.
func initGerrit() error {
var err error
gerritClient, err = gerrit.NewClient(fmt.Sprintf("http://%s:8080", localhost), nil)
if err != nil {
return fmt.Errorf("initializing gerrit client: %w", err)
}
gerritClient.Authentication.SetBasicAuth("admin", "secret")
data := &gerrit.ProjectInput{
Name: gerritProject,
Branches: []string{gerritBranch},
CreateEmptyCommit: true,
}
if _, _, err := gerritClient.Projects.CreateProject(gerritProject, data); err != nil {
return fmt.Errorf("creating test project: %w", err)
}
return nil
}
It ends up with:
creating test project: API call to http://192.168.208.1:8080/a/projects/test/ failed: 400 Bad Request
Great. Thanks a lot, @wwade.
I will try to find time to reproduce this as soon as I can.
Sure, thanks! FWIW, I think the PR is safe either way :)
Thanks @wwade for raising the issue and following up with a fix.
Here's a sample capture:
HTTP Request:
HTTP Response:
It looks like the right answer it to simply
omitempty
foruse_contributor_agreements
etc.