From 232f2964be9f502ac65510b955a5c0502f728128 Mon Sep 17 00:00:00 2001 From: Naoki Kosaka Date: Sun, 25 Nov 2018 12:56:55 +0900 Subject: [PATCH] Fix multiple response.WriteHeader calls (regression #2) --- handle.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handle.go b/handle.go index dc1718e..35c6ab2 100644 --- a/handle.go +++ b/handle.go @@ -183,6 +183,9 @@ func handleInbox(w http.ResponseWriter, r *http.Request, activityDecoder func(*h jsonData, _ := json.Marshal(&resp) go pushRegistorJob(actor.Inbox, jsonData) fmt.Println("Reject Follow Request : ", err.Error(), activity.Actor) + + w.WriteHeader(202) + w.Write(nil) } else { if suitableFollow(activity, actor) { if relConfig.ManuallyAccept { @@ -211,9 +214,6 @@ func handleInbox(w http.ResponseWriter, r *http.Request, activityDecoder func(*h w.WriteHeader(202) w.Write(nil) } - - w.WriteHeader(202) - w.Write(nil) case "Undo": nestedActivity, _ := activitypub.DescribeNestedActivity(activity.Object) if nestedActivity.Type == "Follow" && nestedActivity.Actor == activity.Actor {