Merge pull request #1414 from murgatroid99/grpc-js_dont_split_metadata

grpc-js: Don't split header values by commas
This commit is contained in:
Michael Lumish 2020-05-21 10:29:05 -07:00 committed by GitHub
commit 6c298d3a78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -278,11 +278,7 @@ export class Metadata {
result.add(key, value);
});
} else if (values !== undefined) {
if (isCustomMetadata(key)) {
values.split(',').forEach((v) => result.add(key, v.trim()));
} else {
result.add(key, values);
}
result.add(key, values);
}
}
} catch (error) {

View File

@ -295,6 +295,7 @@ describe('Metadata', () => {
key1: 'value1',
key2: ['value2'],
key3: ['value3a', 'value3b'],
key4: ['part1, part2'],
'key-bin': [
'AAECAwQFBgcICQoLDA0ODw==',
'EBESExQVFhcYGRobHB0eHw==',
@ -307,6 +308,7 @@ describe('Metadata', () => {
['key1', ['value1']],
['key2', ['value2']],
['key3', ['value3a', 'value3b']],
['key4', ['part1, part2']],
[
'key-bin',
[