fix(client/v2): use non-nil context.Context value (#18140)

Prior to this commit, we passed a nil context to the .QueryCtx() and
.createDefaultRequest() methods.

Using any of the context.Context method-set against a nil value will
cause a panic.

This patch passest context.Background() instead of nil.

Closes: 18137
pull/18143/head
Ayan George 2020-05-18 14:56:30 -04:00 committed by GitHub
parent 3b9be0145c
commit c0fe2c30d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -516,7 +516,7 @@ type Result struct {
// Query sends a command to the server and returns the Response.
func (c *client) Query(q Query) (*Response, error) {
return c.QueryCtx(nil, q)
return c.QueryCtx(context.Background(), q)
}
// QueryCtx sends a command to the server and returns the Response.
@ -591,7 +591,7 @@ func (c *client) QueryCtx(ctx context.Context, q Query) (*Response, error) {
// QueryAsChunk sends a command to the server and returns the Response.
func (c *client) QueryAsChunk(q Query) (*ChunkedResponse, error) {
req, err := c.createDefaultRequest(nil, q)
req, err := c.createDefaultRequest(context.Background(), q)
if err != nil {
return nil, err
}