diff --git a/collections.go b/collections.go index 8368447..c004787 100644 --- a/collections.go +++ b/collections.go @@ -874,7 +874,7 @@ func handleViewCollection(app *App, w http.ResponseWriter, r *http.Request) erro } // Serve ActivityStreams data now, if requested - if strings.Contains(r.Header.Get("Accept"), "application/activity+json") { + if IsActivityPubRequest(r) { ac := c.PersonObject() ac.Context = []interface{}{activitystreams.Namespace} setCacheControl(w, apCacheTime) diff --git a/handle.go b/handle.go index 7537b61..1756be3 100644 --- a/handle.go +++ b/handle.go @@ -818,7 +818,7 @@ func (h *Handler) handleHTTPError(w http.ResponseWriter, r *http.Request, err er return } else if err.Status == http.StatusNotFound { w.WriteHeader(err.Status) - if strings.Contains(r.Header.Get("Accept"), "application/activity+json") { + if IsActivityPubRequest(r) { // This is a fediverse request; simply return the header return } diff --git a/posts.go b/posts.go index 589000c..f98b1fb 100644 --- a/posts.go +++ b/posts.go @@ -1546,7 +1546,7 @@ Are you sure it was ever here?`, fmt.Fprintf(w, "# %s\n\n", p.Title.String) } fmt.Fprint(w, p.Content) - } else if strings.Contains(r.Header.Get("Accept"), "application/activity+json") { + } else if IsActivityPubRequest(r) { if !postFound { return ErrCollectionPageNotFound }