Skip to content

Conversation

nikclayton
Copy link
Contributor

Content filters are created with a form-encoded POST request. The Mastodon API defines these in a way that can't be replicated with Retrofit's normal mechanisms for defining an API (including using the @FormUrlEncoded annotation), so NewContentFilterConverterFactory converts the NewContentFilter object to the body of the request.

However, for some servers (at least, GoToSocial) the content-type header is required. That's normally provided by the @FormUrlEncoded annotation, but that can't be used here.

So provide the header directly in the API definition.

Fixes #1375

Content filters are created with a form-encoded POST request. The
Mastodon API defines these in a way that can't be replicated with
Retrofit's normal mechanisms for defining an API (including using the
`@FormUrlEncoded annotation`), so `NewContentFilterConverterFactory`
converts the `NewContentFilter` object to the body of the request.

However, for some servers (at least, GoToSocial) the content-type
header is required. That's normally provided by the `@FormUrlEncoded`
annotation, but that can't be used here.

So provide the header directly in the API definition.

Fixes pachli#1375
@nikclayton nikclayton merged commit a4ad28a into pachli:main Mar 18, 2025
27 checks passed
@nikclayton nikclayton deleted the 1375-gts-content-filter branch March 18, 2025 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot add content filters for a GoToSocial instance
1 participant