diff --git a/collections.go b/collections.go index e3674fa..75e0421 100644 --- a/collections.go +++ b/collections.go @@ -853,7 +853,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 c9ac6ec..2fb23cc 100644 --- a/posts.go +++ b/posts.go @@ -1520,7 +1520,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 }