Description
Bevy version
The release number or commit hash of the version you're using.
0.15.3 (appears to still affect 0.16 though)
What you did
Found the code
In asset loading there are two hardcoded response codes supported. And this is where some of my knowledge may be lacking, but AFAIK 4XX responses are the server saying "Nope you can't touch that" for whatever reason. Could this be improved by accounting for any 4XX response as a file load failure?
I believe this robustness could aid newer developers from more common pitfalls. I've spent literal weeks trying to figure out why I kept getting issues on web and a primary issue was the meta check defaulting to on and Itch.io providing a 403
when bevy would expect a 404
Proposed Solution
match resp.status() {
200 => {
let data = JsFuture::from(resp.array_buffer().unwrap()).await.unwrap();
let bytes = Uint8Array::new(&data).to_vec();
let reader = VecReader::new(bytes);
Ok(reader)
}
400 ..=499 => Err(AssetReaderError::NotFound(path)),
status => Err(AssetReaderError::HttpError(status)),
}
Again likely a bit of naivety on my end, but I imagine all the application really cares about is whether or not the asset can be accessed.