From 880f4f27bd665f3f61a3702885db148ca0c58017 Mon Sep 17 00:00:00 2001 From: Christiaan Titos Bolivar Date: Wed, 22 Nov 2017 17:37:26 +0100 Subject: [PATCH 1/2] Bitbucket v2: return default value when attempt number header is missing (#66) --- service/hook/bitbucketv2/bitbucketv2.go | 2 +- service/hook/bitbucketv2/bitbucketv2_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/service/hook/bitbucketv2/bitbucketv2.go b/service/hook/bitbucketv2/bitbucketv2.go index bb454102..4feb10a1 100644 --- a/service/hook/bitbucketv2/bitbucketv2.go +++ b/service/hook/bitbucketv2/bitbucketv2.go @@ -120,7 +120,7 @@ func detectContentTypeAttemptNumberAndEventKey(header http.Header) (string, stri attemptNum := header.Get("X-Attempt-Number") if attemptNum == "" { - return "", "", "", errors.New("No X-Attempt-Number Header found") + attemptNum = "1" } return contentType, attemptNum, eventKey, nil diff --git a/service/hook/bitbucketv2/bitbucketv2_test.go b/service/hook/bitbucketv2/bitbucketv2_test.go index 01a51e34..5e664b1b 100644 --- a/service/hook/bitbucketv2/bitbucketv2_test.go +++ b/service/hook/bitbucketv2/bitbucketv2_test.go @@ -245,10 +245,10 @@ func Test_detectContentTypeAttemptNumberAndEventKey(t *testing.T) { "Content-Type": {"application/json"}, } contentType, attemptNum, eventKey, err := detectContentTypeAttemptNumberAndEventKey(header) - require.EqualError(t, err, "No X-Attempt-Number Header found") - require.Equal(t, "", contentType) - require.Equal(t, "", eventKey) - require.Equal(t, "", attemptNum) + require.NoError(t, err) + require.Equal(t, "application/json", contentType) + require.Equal(t, "repo:push", eventKey) + require.Equal(t, "1", attemptNum) } } From 96af00c90c52e55b5c51c98f761198a4e25cb939 Mon Sep 17 00:00:00 2001 From: Viktor Benei Date: Wed, 22 Nov 2017 17:37:53 +0100 Subject: [PATCH 2/2] v1.1.37 --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index 6b9ec0bb..232a8d75 100644 --- a/version/version.go +++ b/version/version.go @@ -1,4 +1,4 @@ package version // VERSION ... -const VERSION = "1.1.36" +const VERSION = "1.1.37"