Open MathiasYde opened 4 months ago
Sounds good - PRs welcome!
Are we going for a hard coded user agent or a configurable one? I could take a crack at it
I've been looking through the code a bit and found out that egui-extras uses ehttp for the http ImageLoader which has hardcoded headers of just ("Accept", "*/*")
Do you want to simply pass the headers into ehttp::Request::get function, a builder pattern? (ehttp::Request::get("http://..").with_headers(..).build()
) or perhaps something else?
So a few hours of debugging and I found out that the URL I use to fetch images has unescaped qoutes ("\"https://..\""
) which caused images to fail due to calling to_string()
directly on serde_json::Value
instead of something like as_str().unwrap_or("null").to_string()
:upside_down_face:
A hard-coded User-Agent: egui
is a good start, but adding some way of changing it for EhttpLoader
should be fairly easy.
Is your feature request related to a problem? Please describe.
I'm trying to make an egui program that shows images loaded from an CDN, but it requires that the request has a user agent as a header.
Describe the solution you'd like
Either hardcore the user agent header into the code handling HTTP image loading or add a way to allow passing in a custom user agent
Describe alternatives you've considered
Loading the image using reqwest as bytes and use ImageSource::Bytes in Image
Additional context