From 14178124192a694758b82f93a0773a2a7242e35d Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Thu, 18 Apr 2019 16:09:10 -0400 Subject: [PATCH] 201 is an ok status too --- activity.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/activity.go b/activity.go index 0d7ba4f..a3a4417 100644 --- a/activity.go +++ b/activity.go @@ -91,8 +91,12 @@ func PostMsg(keyname string, key *rsa.PrivateKey, url string, msg []byte) error if err != nil { return err } - if resp.StatusCode != 200 && resp.StatusCode != 202 { - resp.Body.Close() + resp.Body.Close() + switch resp.StatusCode { + case 200: + case 201: + case 202: + default: return fmt.Errorf("http post status: %d", resp.StatusCode) } log.Printf("successful post: %s %d", url, resp.StatusCode)