mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
feat: [net] add "priority" option to net.request (#42628)
document the default value of priority option Update the priority test to not use the httpbin.org as server Fixed the lint errors Fixed the build error
This commit is contained in:
@@ -638,6 +638,24 @@ gin::Handle<SimpleURLLoaderWrapper> SimpleURLLoaderWrapper::Create(
|
||||
break;
|
||||
}
|
||||
|
||||
if (std::string priority; opts.Get("priority", &priority)) {
|
||||
static constexpr auto Lookup =
|
||||
base::MakeFixedFlatMap<std::string_view, net::RequestPriority>({
|
||||
{"throttled", net::THROTTLED},
|
||||
{"idle", net::IDLE},
|
||||
{"lowest", net::LOWEST},
|
||||
{"low", net::LOW},
|
||||
{"medium", net::MEDIUM},
|
||||
{"highest", net::HIGHEST},
|
||||
});
|
||||
if (auto iter = Lookup.find(priority); iter != Lookup.end())
|
||||
request->priority = iter->second;
|
||||
}
|
||||
if (bool priorityIncremental = request->priority_incremental;
|
||||
opts.Get("priorityIncremental", &priorityIncremental)) {
|
||||
request->priority_incremental = priorityIncremental;
|
||||
}
|
||||
|
||||
const bool use_session_cookies =
|
||||
opts.ValueOrDefault("useSessionCookies", false);
|
||||
int options = network::mojom::kURLLoadOptionSniffMimeType;
|
||||
|
||||
Reference in New Issue
Block a user