1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00
go-micro/client/rpc_request_test.go

24 lines
648 B
Go
Raw Normal View History

2018-04-14 19:06:52 +02:00
package client
import (
"testing"
)
func TestRequestOptions(t *testing.T) {
2019-01-10 23:25:31 +02:00
r := newRequest("service", "endpoint", nil, "application/json")
2018-04-14 19:06:52 +02:00
if r.Service() != "service" {
t.Fatalf("expected 'service' got %s", r.Service())
}
2019-01-10 23:25:31 +02:00
if r.Endpoint() != "endpoint" {
t.Fatalf("expected 'endpoint' got %s", r.Endpoint())
2018-04-14 19:06:52 +02:00
}
if r.ContentType() != "application/json" {
2019-01-10 23:25:31 +02:00
t.Fatalf("expected 'endpoint' got %s", r.ContentType())
2018-04-14 19:06:52 +02:00
}
2019-01-10 23:25:31 +02:00
r2 := newRequest("service", "endpoint", nil, "application/json", WithContentType("application/protobuf"))
2018-04-14 19:06:52 +02:00
if r2.ContentType() != "application/protobuf" {
2019-01-10 23:25:31 +02:00
t.Fatalf("expected 'endpoint' got %s", r2.ContentType())
2018-04-14 19:06:52 +02:00
}
}