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

[ENH] Allow custom headers to configure for feed #833

Open
gjimish opened this issue Apr 25, 2023 · 2 comments
Open

[ENH] Allow custom headers to configure for feed #833

gjimish opened this issue Apr 25, 2023 · 2 comments
Assignees

Comments

@gjimish
Copy link

gjimish commented Apr 25, 2023

Is your feature request related to a problem? Please describe.

Allow to pass other headers as well for feed url.

Describe the solution you'd like

simplepie/src/SimplePie.php

Lines 1732 to 1734 in adc91d4

$headers = [
'Accept' => SimplePie::DEFAULT_HTTP_ACCEPT_HEADER,
];
should be configurable.

Describe alternatives you've considered

N/A

Additional context

I can submit a PR.

@Art4
Copy link
Contributor

Art4 commented Apr 25, 2023

By allowing a PSR-18 HTTP client the headers could be changed easily. See #777 and #826.

@jtojnar
Copy link
Contributor

jtojnar commented Apr 25, 2023

I am not sure changing headers is a meaningful operation. SimplePie can make multiple HTTP requests and you probably do not want to set a single Accept header for all of them.

Supplying a custom PSR-18 client with middleware that adjusts headers per request will be probably a better idea.
And you do not need to wait for PSR-18 support, you can pass a custom client, that does whatever with headers, today. We do that in selfoss: https://github.com/fossar/selfoss/blob/c49337513662e772c52235f3617f98a13071cdac/src/helpers/FeedReader.php#L33

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

No branches or pull requests

4 participants