Skip to content

add request in Client struct to override the default request #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type Client struct {
mu sync.Mutex
EncodingBase64 bool
Connected bool
Request *http.Request
}

// NewClient creates a new client
Expand Down Expand Up @@ -293,6 +294,10 @@ func (c *Client) request(ctx context.Context, stream string) (*http.Response, er
if err != nil {
return nil, err
}
// Override request with provided request
if c.Request != nil {
req = c.Request
}
req = req.WithContext(ctx)

// Setup request, specify stream to connect to
Expand Down