Omit null mimeType from ResourceContents JSON serialization (#1325)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
This commit is contained in:
Copilot 2026-02-20 03:46:56 +00:00 • committed by GitHub
commit 3727dc4aaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -158,7 +158,10 @@ public abstract class ResourceContents
writer.WriteStartObject();
writer.WriteString("uri", value.Uri);
writer.WriteString("mimeType", value.MimeType);
if (value.MimeType is not null)
{
writer.WriteString("mimeType", value.MimeType);
}
Debug.Assert(value is BlobResourceContents or TextResourceContents);
if (value is BlobResourceContents blobResource)