-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add scheme configuration #159
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
feat: add scheme configuration #159
Conversation
3a750a6 to
4ddd70e
Compare
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.
Pull Request Overview
This PR introduces a configurable scheme for the Bucketeer SDK, allowing the client to use either HTTP or HTTPS for API requests.
- Adds a scheme option to the Bucketeer options and default configuration.
- Updates tests to cover the new scheme option.
- Modifies API client URL construction to use the configurable scheme.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/bucketeer/sdk.go | Updated API client instantiation to pass the scheme configuration. |
| pkg/bucketeer/option_test.go | Added tests to assert correct scheme configuration. |
| pkg/bucketeer/option.go | Introduced scheme in options with a default value and the corresponding setter. |
| pkg/bucketeer/api/client.go | Added error definitions and validation for scheme, but missing assignment in client constructor. |
| pkg/bucketeer/api/api.go | Modified API URL constructions to use the configurable scheme. |
Comments suppressed due to low confidence (1)
pkg/bucketeer/api/client.go:65
- The ClientConfig's scheme field is not assigned to the client struct. Consider assigning the scheme (e.g., scheme: string(conf.Scheme)) to ensure that the URL is constructed using the configured scheme.
client := &client{ apiKey: conf.APIKey, host: conf.Host, }
24c820b to
8a0f3da
Compare
|
Hi, @cre8ivejp |
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.
Thank you so much for your contribution!
I left a few comments. Please take a look when you have time.
pkg/bucketeer/api/api.go
Outdated
| } | ||
| if c.scheme == "http" { | ||
| client.Transport = &http.Transport{ | ||
| // This setting is for developping on local machine. |
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 setting is for developping on local machine. | |
| // This setting is for developing on local machines. |
8a0f3da to
e8d61f4
Compare
|
@cre8ivejp |
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.
LGTM!
|
@sivchari, the e2e tests are failing. === NAME TestGetSegmentUsers
api_test.go:78:
Error Trace: /home/runner/work/go-server-sdk/go-server-sdk/test/e2e/api_test.go:227
/home/runner/work/go-server-sdk/go-server-sdk/test/e2e/api_test.go:78
Error: Received unexpected error:
scheme must be http or https
Test: TestGetSegmentUsers
--- FAIL: TestGetSegmentUsers (0.00s)You must also update here. |
13b193f to
54fcfde
Compare
Signed-off-by: sivchari <shibuuuu5@gmail.com>
54fcfde to
b542494
Compare
|
@cre8ivejp |
|
ping |
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.
Once again, thank you so much for your contribution 🎉
Currently, go-server-sdk doesn't provide way to handle scheme and it's hard to debug on local since the all request send to as a HTTPS.
By making client's scheme configurable, we can use client not only hosting environment but also local one.