metadata: allow to remove key from metadata (#1453)

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-03-31 22:55:33 +03:00
committed by GitHub
parent 18061723bb
commit 5e65a46be3
2 changed files with 41 additions and 2 deletions

View File

@@ -18,6 +18,27 @@ func TestMetadataSet(t *testing.T) {
}
}
func TestMetadataDel(t *testing.T) {
md := Metadata{
"Foo": "bar",
"Baz": "empty",
}
ctx := NewContext(context.TODO(), md)
ctx = Set(ctx, "Baz", "")
emd, ok := FromContext(ctx)
if !ok {
t.Fatal("key Key not found")
}
_, ok = emd["Baz"]
if ok {
t.Fatal("key Baz not deleted")
}
}
func TestMetadataCopy(t *testing.T) {
md := Metadata{
"Foo": "bar",