-
Notifications
You must be signed in to change notification settings - Fork 5
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
Insert middleware to allow org and prod id on requests #142
Insert middleware to allow org and prod id on requests #142
Conversation
httpclient/httpclient.go
Outdated
@@ -84,6 +100,15 @@ func New(cfg Config) (runtime *httptransport.Runtime, err error) { | |||
transport = &roundTripperWithSourceChannel{OriginalRoundTripper: transport, SourceChannel: sourceChannel} | |||
} | |||
|
|||
if cfg.Profile().OrganizationID != "" || cfg.Profile().ProjectID != "" { |
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.
Let's make sure we have validation that these are always set together. Both populated, or both empty.
httpclient/httpclient.go
Outdated
ProjectID string | ||
} | ||
|
||
func (rt *roundTripperWithProfile) RoundTrip(req *http.Request) (*http.Response, error) { |
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.
Would like to see a refactor where we only overwrite the Roundtrip
function once. Maybe a single struct called roundTripperWithMiddleware
with sourceChannel and profile middleware functions as its fields?
53f7d71
to
1ad9e50
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.
π π
π οΈ Description
These code changes include added middleware to allow organization and project id collected from a user's profile to attach to client requests.
π External Links
HCE-652 : Middleware package that injects the saved project ID/org ID into every SDK request
π Definition of Done