Rework client interface
This commit is contained in:
		
							
								
								
									
										23
									
								
								client/rpc_request_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								client/rpc_request_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| package client | ||||
|  | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
|  | ||||
| func TestRequestOptions(t *testing.T) { | ||||
| 	r := newRequest("service", "method", nil, "application/json") | ||||
| 	if r.Service() != "service" { | ||||
| 		t.Fatalf("expected 'service' got %s", r.Service()) | ||||
| 	} | ||||
| 	if r.Method() != "method" { | ||||
| 		t.Fatalf("expected 'method' got %s", r.Method()) | ||||
| 	} | ||||
| 	if r.ContentType() != "application/json" { | ||||
| 		t.Fatalf("expected 'method' got %s", r.ContentType()) | ||||
| 	} | ||||
|  | ||||
| 	r2 := newRequest("service", "method", nil, "application/json", WithContentType("application/protobuf")) | ||||
| 	if r2.ContentType() != "application/protobuf" { | ||||
| 		t.Fatalf("expected 'method' got %s", r2.ContentType()) | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user