Skip to content

Conversation

@puzzler995
Copy link

Modified ActivityPubOptions and ActivityPubClient to instead have a ContentType record struct, so it can handle both MediaType and Profile.

Feel free to let me know if there's anything I need to change. I've tested it as much as I can, but if you know of any softwares that actually follow the spec on this that I can test against, I will for sure.

Copy link
Owner

@warriordog warriordog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@puzzler995 thank you so much for the contribution! I left a few requests, but I can make the changes myself if you prefer.

/// </summary>
/// <param name="MediaType">A MIME type for the header</param>
/// <param name="Profile">A profile to append to the MIME type, leave empty for none</param>
public record struct ContentType(string MediaType, string Profile);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make Profile optional, with a default value of ""?

return obj;
}

private static bool IsContentTypeMatch(MediaTypeHeaderValue actual, ActivityPubOptions.ContentType expected) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

foreach (var mimeType in apOptions.RequestContentTypes)
{
var mediaType = new MediaTypeWithQualityHeaderValue(mimeType);
var mediaType = new MediaTypeWithQualityHeaderValue(mimeType.MediaType);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we move this logic to an implicit cast in ContentType?

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.

2 participants