diff --git a/main.go b/main.go index 5eb2f5f..098af81 100644 --- a/main.go +++ b/main.go @@ -38,8 +38,10 @@ import ( "gopkg.in/yaml.v2" ) +// DefaultIssueBodyTemplate is the default template used for `issue_body_template` in the config. +// // !!! Keep in step with the documentation in `rageshake.sample.yaml` !!! -const DEFAULT_ISSUE_BODY_TEMPLATE = `User message: +const DefaultIssueBodyTemplate = `User message: {{ .UserText }} {{ range $key, $val := .Data -}} @@ -121,7 +123,7 @@ func main() { issueTemplate := cfg.IssueBodyTemplate if issueTemplate == "" { - issueTemplate = DEFAULT_ISSUE_BODY_TEMPLATE + issueTemplate = DefaultIssueBodyTemplate } parsedIssueTemplate, err := template.New("issue").Parse(issueTemplate) if err != nil { diff --git a/submit_test.go b/submit_test.go index 71a5b6e..f3af92b 100644 --- a/submit_test.go +++ b/submit_test.go @@ -57,11 +57,10 @@ func testParsePayload(t *testing.T, body, contentType string, tempDir string) (* return p, rr.Result() } - func submitSimpleRequestToServer(t *testing.T, allowedAppNameMap map[string]bool, body string) int { - // Submit a request without files to the server and return statusCode - // Could be extended with more complicated config; aimed here just to - // test options for allowedAppNameMap + // Submit a request without files to the server and return statusCode + // Could be extended with more complicated config; aimed here just to + // test options for allowedAppNameMap req, err := http.NewRequest("POST", "/api/submit", strings.NewReader(body)) if err != nil { @@ -445,7 +444,7 @@ Content-Disposition: form-data; name="version" t.Fatal("parseRequest returned nil") } - parsedIssueTemplate := template.Must(template.New("issue").Parse(DEFAULT_ISSUE_BODY_TEMPLATE)) + parsedIssueTemplate := template.Must(template.New("issue").Parse(DefaultIssueBodyTemplate)) issueReq, err := buildGithubIssueRequest(*p, "http://test/listing/foo", parsedIssueTemplate) if err != nil { t.Fatalf("Error building issue request: %s", err) @@ -481,7 +480,7 @@ riot-web t.Fatal("parseRequest returned nil") } - parsedIssueTemplate := template.Must(template.New("issue").Parse(DEFAULT_ISSUE_BODY_TEMPLATE)) + parsedIssueTemplate := template.Must(template.New("issue").Parse(DefaultIssueBodyTemplate)) issueReq, err := buildGithubIssueRequest(*p, "http://test/listing/foo", parsedIssueTemplate) if err != nil { t.Fatalf("Error building issue request: %s", err) @@ -511,7 +510,7 @@ Content-Disposition: form-data; name="text" t.Fatal("parseRequest returned nil") } - parsedIssueTemplate := template.Must(template.New("issue").Parse(DEFAULT_ISSUE_BODY_TEMPLATE)) + parsedIssueTemplate := template.Must(template.New("issue").Parse(DefaultIssueBodyTemplate)) issueReq, err := buildGithubIssueRequest(*p, "http://test/listing/foo", parsedIssueTemplate) if err != nil { t.Fatalf("Error building issue request: %s", err) @@ -568,7 +567,7 @@ user_id: id } } - parsedIssueTemplate := template.Must(template.New("issue").Parse(DEFAULT_ISSUE_BODY_TEMPLATE)) + parsedIssueTemplate := template.Must(template.New("issue").Parse(DefaultIssueBodyTemplate)) for k, v := range sample { p := payload{Data: v.data} res, err := buildGithubIssueRequest(p, "", parsedIssueTemplate)