http: Specify expected mime types in downloads.

This commit is contained in:
Unknown W. Brackets committed 2021-08-22 10:03:59 -07:00
1 parent 4c51f4761d
commit afcf6d8e65
6 files changed
+28 -12

No files matched your search

+5 -3
View File
@@ -134,7 +134,9 @@ void HttpImageFileView::DownloadCompletedCallback(http::Download &download) {
void HttpImageFileView::Draw(UIContext &dc) {
using namespace Draw;
if (!texture_ && !textureFailed_ && !path_.empty() && !download_) {
download_ = downloader_->StartDownloadWithCallback(path_, Path(), std::bind(&HttpImageFileView::DownloadCompletedCallback, this, std::placeholders::_1));
auto cb = std::bind(&HttpImageFileView::DownloadCompletedCallback, this, std::placeholders::_1);
const char *acceptMime = "image/png, image/jpeg, image/*; q=0.9, */*; q=0.8";
download_ = downloader_->StartDownloadWithCallback(path_, Path(), cb, acceptMime);
download_->SetHidden(true);
}
@@ -366,8 +368,8 @@ StoreScreen::StoreScreen() {
loading_ = true;
std::string indexPath = storeBaseUrl + "index.json";
listing_ = g_DownloadManager.StartDownload(indexPath, Path());
const char *acceptMime = "application/json, */*; q=0.8";
listing_ = g_DownloadManager.StartDownload(indexPath, Path(), acceptMime);
}
StoreScreen::~StoreScreen() {