Fix multiple response.WriteHeader calls (regression #2)

This commit is contained in:
Naoki Kosaka 2018-11-25 12:56:55 +09:00
parent eb93b37654
commit 232f2964be

View File

@ -183,6 +183,9 @@ func handleInbox(w http.ResponseWriter, r *http.Request, activityDecoder func(*h
jsonData, _ := json.Marshal(&resp) jsonData, _ := json.Marshal(&resp)
go pushRegistorJob(actor.Inbox, jsonData) go pushRegistorJob(actor.Inbox, jsonData)
fmt.Println("Reject Follow Request : ", err.Error(), activity.Actor) fmt.Println("Reject Follow Request : ", err.Error(), activity.Actor)
w.WriteHeader(202)
w.Write(nil)
} else { } else {
if suitableFollow(activity, actor) { if suitableFollow(activity, actor) {
if relConfig.ManuallyAccept { if relConfig.ManuallyAccept {
@ -211,9 +214,6 @@ func handleInbox(w http.ResponseWriter, r *http.Request, activityDecoder func(*h
w.WriteHeader(202) w.WriteHeader(202)
w.Write(nil) w.Write(nil)
} }
w.WriteHeader(202)
w.Write(nil)
case "Undo": case "Undo":
nestedActivity, _ := activitypub.DescribeNestedActivity(activity.Object) nestedActivity, _ := activitypub.DescribeNestedActivity(activity.Object)
if nestedActivity.Type == "Follow" && nestedActivity.Actor == activity.Actor { if nestedActivity.Type == "Follow" && nestedActivity.Actor == activity.Actor {