Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"mallocCountTotal" : 2000,
"memoryLeaked" : 0,
"releaseCount" : 6001,
"retainCount" : 2000,
"syscalls" : 0
"mallocCountTotal": 1000
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"mallocCountTotal" : 2000,
"memoryLeaked" : 0,
"releaseCount" : 6001,
"retainCount" : 2000,
"syscalls" : 0
"mallocCountTotal": 1000
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"mallocCountTotal" : 2000,
"memoryLeaked" : 0,
"releaseCount" : 7001,
"retainCount" : 3000,
"syscalls" : 0
"mallocCountTotal": 1000
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"mallocCountTotal" : 2000,
"memoryLeaked" : 0,
"releaseCount" : 7001,
"retainCount" : 3000,
"syscalls" : 0
"mallocCountTotal": 1000
}
2 changes: 1 addition & 1 deletion Sources/GRPCCore/Metadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ extension Metadata {
switch value {
case .string(let stringValue):
do {
return try Base64.decode(string: stringValue)
return try Base64.decode(string: stringValue, options: [.omitPaddingCharacter])
} catch {
continue
}
Expand Down
12 changes: 12 additions & 0 deletions Tests/GRPCCoreTests/MetadataTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,18 @@ struct MetadataTests {
#expect(Array(metadata[binaryValues: "key-bin"]) == expected)
}

@Test("Iterate over unpadded base64 encoded binary values for a key")
@available(gRPCSwift 2.0, *)
func iterateOverUnpaddedBase64BinaryEncodedValuesForKey() {
let metadata: Metadata = [
"key-bin": "YQ==",
"key-bin": "YQ",
]

let expected: [[UInt8]] = [[UInt8(ascii: "a")], [UInt8(ascii: "a")]]
#expect(Array(metadata[binaryValues: "key-bin"]) == expected)
}

@Test("Subscripts are case-insensitive")
@available(gRPCSwift 2.0, *)
func subscriptIsCaseInsensitive() {
Expand Down