gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/client/rpc_request_test.go (about) 1 package client 2 3 import ( 4 "testing" 5 ) 6 7 func TestRequestOptions(t *testing.T) { 8 r := newRequest("service", "endpoint", nil, "application/json") 9 if r.Service() != "service" { 10 t.Fatalf("expected 'service' got %s", r.Service()) 11 } 12 if r.Endpoint() != "endpoint" { 13 t.Fatalf("expected 'endpoint' got %s", r.Endpoint()) 14 } 15 if r.ContentType() != "application/json" { 16 t.Fatalf("expected 'endpoint' got %s", r.ContentType()) 17 } 18 19 r2 := newRequest("service", "endpoint", nil, "application/json", WithContentType("application/protobuf")) 20 if r2.ContentType() != "application/protobuf" { 21 t.Fatalf("expected 'endpoint' got %s", r2.ContentType()) 22 } 23 }