From 7889596cb0c6840c3d26b9fc9d7cd67c8c925241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=9C=C9=B4=E1=B4=8B=C9=B4=E1=B4=A1=E1=B4=8F=C9=B4?= Date: Fri, 17 Apr 2020 09:00:40 +0800 Subject: [PATCH 1/2] Remove version --- captcha.go | 6 ------ captcha_test.go | 6 ------ 2 files changed, 12 deletions(-) diff --git a/captcha.go b/captcha.go index 8bdd7cd..b7c176e 100644 --- a/captcha.go +++ b/captcha.go @@ -28,12 +28,6 @@ import ( "gopkg.in/macaron.v1" ) -const _VERSION = "0.1.0" - -func Version() string { - return _VERSION -} - var ( defaultChars = []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} ) diff --git a/captcha_test.go b/captcha_test.go index 1c4391b..6b6175f 100644 --- a/captcha_test.go +++ b/captcha_test.go @@ -24,12 +24,6 @@ import ( "gopkg.in/macaron.v1" ) -func Test_Version(t *testing.T) { - Convey("Get version", t, func() { - So(Version(), ShouldEqual, _VERSION) - }) -} - func Test_Captcha(t *testing.T) { Convey("Captch service", t, func() { m := macaron.New() From 652de64697bdea97bb022637d7bb3e9c391e5209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=9C=C9=B4=E1=B4=8B=C9=B4=E1=B4=A1=E1=B4=8F=C9=B4?= Date: Fri, 17 Apr 2020 09:02:05 +0800 Subject: [PATCH 2/2] Write status before content --- captcha.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/captcha.go b/captcha.go index b7c176e..71dfbd0 100644 --- a/captcha.go +++ b/captcha.go @@ -236,10 +236,10 @@ func Captchaer(options ...Options) macaron.Handler { } } + ctx.Status(200) if _, err := NewImage([]byte(chars), cpt.StdWidth, cpt.StdHeight, cpt.ColorPalette).WriteTo(ctx.Resp); err != nil { panic(fmt.Errorf("write captcha: %v", err)) } - ctx.Status(200) return }