Skip to content

FIX handle Mastodon using Content-Type header instead of Accept

kik requested to merge gitlab-community/gitlab:mastodon_accept_header into master

What does this MR do and why?

When Mastodon fetches the profile URL for an actor, it sets the ActivityPub Accept header, as specified by the standard.

But then, when it sends Follow activities, it switches to using Content-Type header, as this is the content type for the request body, and they don't care about the response body (only that the HTTP status is 200), so we need to handle that.

How to set up and validate locally

  1. activity features flags in console : Feature.enable(:activity_pub); Feature.enable(:activity_pub_project)
  2. create a few releases in the Flightjs/Flight project
  3. run curl "http://127.0.0.1:3000/flightjs/Flight/-/releases", it returns a HTML page
  4. run curl -H 'Accept: application/activity+json' "http://127.0.0.1:3000/flightjs/Flight/-/releases", it returns the ActivityStreams JSON object.
  5. run curl -H 'Accept:' -H 'Content-Type: application/activity+json' "http://127.0.0.1:3000/flightjs/Flight/-/releases", it returns the ActivityStreams object as well.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by kik

Merge request reports