Default client function moved to client_test.go as its only used there.

This commit is contained in:
Musab Gültekin 2021-05-23 23:47:43 +03:00
parent f35d34bc02
commit 5aa2c2540e
2 changed files with 11 additions and 9 deletions

View File

@ -78,15 +78,6 @@ func NewClient(opt *Options) *Client {
return &client return &client
} }
// newClientDefault creates new client with default options
func newClientDefault() *Client {
return NewClient(&Options{
MaxBodySize: DefaultMaxBody,
RetryTimes: DefaultRetryTimes,
RetryHTTPCodes: DefaultRetryHTTPCodes,
})
}
// DoRequest selects appropriate request handler, client or Chrome // DoRequest selects appropriate request handler, client or Chrome
func (c *Client) DoRequest(req *Request) (resp *Response, err error) { func (c *Client) DoRequest(req *Request) (resp *Response, err error) {
if req.Rendered { if req.Rendered {

View File

@ -2,6 +2,7 @@ package client
import ( import (
"fmt" "fmt"
"github.com/chromedp/chromedp"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
@ -145,3 +146,13 @@ func TestRetry(t *testing.T) {
assert.Nil(t, res) assert.Nil(t, res)
assert.Error(t, err) assert.Error(t, err)
} }
// newClientDefault creates new client with default options
func newClientDefault() *Client {
return NewClient(&Options{
MaxBodySize: DefaultMaxBody,
RetryTimes: DefaultRetryTimes,
RetryHTTPCodes: DefaultRetryHTTPCodes,
AllocatorOptions: chromedp.DefaultExecAllocatorOptions[:],
})
}