diff --git a/transport/http/calloption_test.go b/transport/http/calloption_test.go index 4fe6f3a58..39be878d3 100644 --- a/transport/http/calloption_test.go +++ b/transport/http/calloption_test.go @@ -96,3 +96,30 @@ func TestHeaderCallOption_after(t *testing.T) { t.Errorf("want: %v,got: %v", &h, o.(HeaderCallOption).header) } } + +func TestHeaders(t *testing.T) { + if !reflect.DeepEqual(map[string]string{ + "trace_id": "xxxx", + }, Headers(map[string]string{ + "trace_id": "xxxx", + }).(HeadersCallOption).headers) { + t.Errorf("want: %v,got: %v", "{'trace_id': 'xxxx'}", Headers(map[string]string{ + "trace_id": "xxxx", + }).(HeadersCallOption).headers) + } +} + +func TestHeadersCallOption_before(t *testing.T) { + c := &callInfo{} + err := Headers(map[string]string{ + "trace_id": "xxxx", + }).before(c) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + if !reflect.DeepEqual(map[string]string{ + "trace_id": "xxxx", + }, c.headers) { + t.Errorf("want: %v, got: %v", "{'trace_id': 'xxxx'}", c.headers) + } +}