Default client function moved to client_test.go as its only used there.
This commit is contained in:
parent
f35d34bc02
commit
5aa2c2540e
@ -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 {
|
||||||
|
@ -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[:],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user