Browse code

[BZ1163618] Add missing user agent to error message

Jeff Cantrill authored on 2014/11/13 22:54:43
Showing 2 changed files
... ...
@@ -89,7 +89,7 @@ func verifyRequest(req *http.Request) error {
89 89
 		return fmt.Errorf("Unsupported Content-Type %s", contentType)
90 90
 	}
91 91
 	if userAgent := req.Header.Get("User-Agent"); !strings.HasPrefix(userAgent, "GitHub-Hookshot/") {
92
-		return fmt.Errorf("Unsupported User-Agent %s")
92
+		return fmt.Errorf("Unsupported User-Agent %s", userAgent)
93 93
 	}
94 94
 	if req.Header.Get("X-GitHub-Event") == "" {
95 95
 		return errors.New("Missing X-GitHub-Event")
... ...
@@ -80,7 +80,7 @@ func TestWrongUserAgent(t *testing.T) {
80 80
 	resp, _ := client.Do(req)
81 81
 	body, _ := ioutil.ReadAll(resp.Body)
82 82
 	if resp.StatusCode != http.StatusBadRequest ||
83
-		!strings.Contains(string(body), "User-Agent") {
83
+		!strings.Contains(string(body), "User-Agent go-lang") {
84 84
 		t.Errorf("Excepcted BadRequest, got %s: %s!", resp.Status, string(body))
85 85
 	}
86 86
 }