From 62ec7d527883985bdb80ad8c7851f00a84a125c3 Mon Sep 17 00:00:00 2001 From: Cory Slep Date: Sun, 3 Jun 2018 01:29:47 +0200 Subject: [PATCH] Fix logic for Accept and Content-Type headers --- pub/internal.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pub/internal.go b/pub/internal.go index 87e5eee..8647799 100644 --- a/pub/internal.go +++ b/pub/internal.go @@ -58,11 +58,11 @@ func headerEqualsOneOf(header string, acceptable []string) bool { } func isActivityPubPost(r *http.Request) bool { - return r.Method == "POST" && headerEqualsOneOf(r.Header.Get(contentTypeHeader), []string{postContentTypeHeader, contentTypeHeader}) + return r.Method == "POST" && headerEqualsOneOf(r.Header.Get(contentTypeHeader), append([]string{postContentTypeHeader}, alternatives...)) } func isActivityPubGet(r *http.Request) bool { - return r.Method == "GET" && headerEqualsOneOf(r.Header.Get(acceptHeader), []string{getAcceptHeader, contentTypeHeader}) + return r.Method == "GET" && headerEqualsOneOf(r.Header.Get(acceptHeader), append([]string{getAcceptHeader}, alternatives...)) } // isPublic determines if a target is the Public collection as defined in the