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

Throw an error if someone passes a headers option to the constructor #142

Open
tobyink opened this issue Nov 14, 2020 · 2 comments
Open
Labels

Comments

@tobyink
Copy link

tobyink commented Nov 14, 2020

request (and get, post, etc) accepts an option called headers. Its return hashref also includes a key called headers.

But the constructor accepts an option called default_headers. I accidentally used headers and was confused for at least an hour about why the API that I was calling kept returning 403 Forbidden. (Didn't help that it was behind Cloudflare, so I thought they were the ones blocking me.)

It would be nice if HTTP::Tiny->new( headers => \%h ) threw an error or at least a warning. Either the constructor could complain about all unrecognized options, or just headers. Either way.

@xdg
Copy link
Collaborator

xdg commented Jul 19, 2021

If we add a warning, it probably makes sense to warn about any unknown attribute.

@xdg xdg added the Wishlist label Jul 19, 2021
@guest20
Copy link

guest20 commented Jul 3, 2023

If we're doing a wish list for being warned when you put it in the wrong place, I'd like warnings for unknown keys in \%options in $http->request($method, $url, \%options);, just to save a hypothetical developer 90 minutes trying to figure out why their If-Modified-Since header doesn't seem to be going anywhere...

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

No branches or pull requests

3 participants