From 44f281f8d9acf95c7b2a03734d5ae9584dd2d0b1 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Sun, 23 Aug 2020 14:13:45 +0100 Subject: [PATCH] remove test request file --- client/backoff_test.go | 62 ++++++++++++++++++++++++++++++++++++++++ client/test_request.go | 65 ------------------------------------------ 2 files changed, 62 insertions(+), 65 deletions(-) delete mode 100644 client/test_request.go diff --git a/client/backoff_test.go b/client/backoff_test.go index 5b9b60b8..37480ff8 100644 --- a/client/backoff_test.go +++ b/client/backoff_test.go @@ -4,6 +4,8 @@ import ( "context" "testing" "time" + + "github.com/micro/go-micro/v3/codec" ) func TestBackoff(t *testing.T) { @@ -32,3 +34,63 @@ func TestBackoff(t *testing.T) { } } } + +type testRequest struct { + service string + method string + endpoint string + contentType string + codec codec.Codec + body interface{} + opts RequestOptions +} + +func newRequest(service, endpoint string, request interface{}, contentType string, reqOpts ...RequestOption) Request { + var opts RequestOptions + + for _, o := range reqOpts { + o(&opts) + } + + // set the content-type specified + if len(opts.ContentType) > 0 { + contentType = opts.ContentType + } + + return &testRequest{ + service: service, + method: endpoint, + endpoint: endpoint, + body: request, + contentType: contentType, + opts: opts, + } +} + +func (r *testRequest) ContentType() string { + return r.contentType +} + +func (r *testRequest) Service() string { + return r.service +} + +func (r *testRequest) Method() string { + return r.method +} + +func (r *testRequest) Endpoint() string { + return r.endpoint +} + +func (r *testRequest) Body() interface{} { + return r.body +} + +func (r *testRequest) Codec() codec.Writer { + return r.codec +} + +func (r *testRequest) Stream() bool { + return r.opts.Stream +} diff --git a/client/test_request.go b/client/test_request.go deleted file mode 100644 index 80e1d175..00000000 --- a/client/test_request.go +++ /dev/null @@ -1,65 +0,0 @@ -package client - -import ( - "github.com/micro/go-micro/v3/codec" -) - -type testRequest struct { - service string - method string - endpoint string - contentType string - codec codec.Codec - body interface{} - opts RequestOptions -} - -func newRequest(service, endpoint string, request interface{}, contentType string, reqOpts ...RequestOption) Request { - var opts RequestOptions - - for _, o := range reqOpts { - o(&opts) - } - - // set the content-type specified - if len(opts.ContentType) > 0 { - contentType = opts.ContentType - } - - return &testRequest{ - service: service, - method: endpoint, - endpoint: endpoint, - body: request, - contentType: contentType, - opts: opts, - } -} - -func (r *testRequest) ContentType() string { - return r.contentType -} - -func (r *testRequest) Service() string { - return r.service -} - -func (r *testRequest) Method() string { - return r.method -} - -func (r *testRequest) Endpoint() string { - return r.endpoint -} - -func (r *testRequest) Body() interface{} { - return r.body -} - -func (r *testRequest) Codec() codec.Writer { - return r.codec -} - -func (r *testRequest) Stream() bool { - return r.opts.Stream -}