Fix McpHeaderEncoder.DecodeValue throwing on the degenerate base64 wrapper (#1805)

This commit is contained in:
Recoordinate 2026-08-13 18:27:48 +12:00 • committed by GitHub
commit bba45c44bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -104,6 +104,16 @@ public class McpHeaderEncoderTests
Assert.Equal("Hello", result);
}
[Fact]
public void DecodeValue_DegenerateWrapper_ReturnsLiteralValue()
{
// "=?base64?=" matches both the prefix "=?base64?" and the suffix "?=" because they
// overlap on the shared '?', but it is too short to contain any base64 content. It must be
// returned as-is rather than throwing when the wrapper is stripped.
var result = McpHeaderEncoder.DecodeValue("=?base64?=");
Assert.Equal("=?base64?=", result);
}
[Fact]
public void DecodeValue_CaseSensitivePrefix_ReturnsLiteralValue()
{