-
Notifications
You must be signed in to change notification settings - Fork 52
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
Introduce possibility for custom HTTP Headers in HTTP source #371
base: develop
Are you sure you want to change the base?
Introduce possibility for custom HTTP Headers in HTTP source #371
Conversation
Custom HTTP headers for the HTTP source can be provided via a new field httpHeadersSecretRef in the HTTP source spec. All key value pairs from that secret will be added as HTTP Header to the HTTP request to fetch the file from the HTTP source. Signed-off-by: Christopher Friedrich <christopher.friedrich1@gmail.com>
} | ||
|
||
for name, value := range secret.Data { | ||
req.Header.Set(name, string(value)) |
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.
I've made a design decision here you may want to revisit: This introduces the possibility, that the Basic Authentication headers, set via the secretRef
field, may be overwritten, if there is a value for that Header provided in the secret for httpHeadersSecretRef
.
I could also rework this and prohibit the overwriting for the Basic Auth headers if you like. Nevertheless I'll open a PR to also document this properly in either case.
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.
I think we should prevent at least the Auth header from being updated.
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 the PR @christopherfriedrich!!
I think the changes mostly looks good. @christopherfriedrich Do you think you would be able to add some tests for this?
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 the PR @christopherfriedrich!!
I think the changes mostly looks good. @christopherfriedrich Do you think you would be able to add some tests for this?
+1
This PR introduces the possibility to add custom HTTP Headers to requests for fetching HTTP sources and thereby fixes #87.
The custom HTTP headers for the HTTP source can be provided via a new field
httpHeadersSecretRef
in the HTTP source spec. All key value pairs from that secret will be added as HTTP Header to the HTTP request to fetch the file from the HTTP source.