Skip to content
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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

christopherfriedrich
Copy link

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.

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))
Copy link
Author

@christopherfriedrich christopherfriedrich Mar 29, 2024

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.

Copy link
Member

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.

Copy link
Member

@praveenrewar praveenrewar left a 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?

Copy link
Contributor

@kumaritanushree kumaritanushree left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Possibility to add custom headers for HTTP downloads
4 participants