-
Notifications
You must be signed in to change notification settings - Fork 42
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
[Fix] Support Query parameters for all HTTP operations #1124
base: main
Are you sure you want to change the base?
Conversation
client/client_test.go
Outdated
}, | ||
nil, | ||
map[string]string{ | ||
"c": "d", | ||
}, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This formatting is hard to read and not consistent, let's do something slightly more idiomatic:
err = c.Do(
context.Background(),
"GET",
"/a/b",
map[string]string{"e": "f"},
nil,
map[string]string{"c": "d"},
nil,
)
Also applies to other tests.
client/client_test.go
Outdated
}, | ||
nil, | ||
map[string]string{ | ||
"c": "d", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also cover cases where the value is not a string?
8972af3
to
279f0c5
Compare
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
@@ -141,3 +141,26 @@ func TestEncodeMultiSegmentPathParameter(t *testing.T) { | |||
// # and ? should be encoded. | |||
assert.Equal(t, "a%23b%3Fc", EncodeMultiSegmentPathParameter("a#b?c")) | |||
} | |||
|
|||
func TestMakeRequestBodyExplicitQueryParams(t *testing.T) { | |||
type x struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear, the first scenario should not happen, IIUC. For GET/HEAD/DELETE requests, extra query parameters are never passed in.
Could the second scenario happen, where the request contains url
tags that are overridden by the explicit query parameters?
@@ -63,12 +63,13 @@ func (c *DatabricksClient) GetOAuthToken(ctx context.Context, authDetails string | |||
|
|||
// Do sends an HTTP request against path. | |||
func (c *DatabricksClient) Do(ctx context.Context, method, path string, | |||
headers map[string]string, request, response any, | |||
headers map[string]string, queryParams map[string]any, request, response any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For external clients (like Terraform), the migration path is to pass nil for GET/HEAD/DELETE requests and to explicitly pass the query parameters here?
What changes are proposed in this pull request?
Support Query parameters for all HTTP operations. Previously, only GET/HEAD/DELETE were supported.
How is this tested?