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

Add support for custom headers in input processing #1561

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mre
Copy link
Member

@mre mre commented Nov 7, 2024

Previously, we didn't pass (auth) headers to the initial set of inputs -- only to the links which were discovered in the initial input set. That's inconsistent and led to some confusion.

This PR fixes that. There is probably a nicer design for input parsing; the constructor has quite a few "dummy" params now, which tend to be set to the same values. I guess we can refactor that to, say, introduce the notion of an InputBuilder if it becomes to tedious to set these values. I guess we should decouple input parsing for the different input types in general because header handling is only needed for web requests and not for file inputs.

For now, I just introduced a helper method Input::from_value.

This fixes #1441.

@mre mre requested a review from thomas-zahner November 7, 2024 21:41
@@ -195,9 +195,18 @@ impl LycheeOptions {
} else {
Some(self.config.exclude_path.clone())
};
let headers = parse_headers(&self.config.header)?;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not ideal because we parse the headers twice: here and in lychee-bin/src/client. We should probably move the parsing to the Clap config.

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

Successfully merging this pull request may close these issues.

custom Header not sent
1 participant