mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Make preferred languages configurable
This also changes fetch to use the preferred languages for the Accept-Language header.
This commit is contained in:
parent
2cfc1873c0
commit
2ca8fd1832
Notes:
github-actions[bot]
2024-07-25 10:39:58 +00:00
Author: https://github.com/jamierocks
Commit: 2ca8fd1832
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/796
Reviewed-by: https://github.com/tcl3 ✅
9 changed files with 31 additions and 8 deletions
|
@ -235,7 +235,10 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Infrastructure::FetchController>> fetch(JS:
|
|||
// 14. If request’s header list does not contain `Accept-Language`, then user agents should append
|
||||
// (`Accept-Language, an appropriate header value) to request’s header list.
|
||||
if (!request.header_list()->contains("Accept-Language"sv.bytes())) {
|
||||
auto header = Infrastructure::Header::from_string_pair("Accept-Language"sv, "*"sv);
|
||||
StringBuilder accept_language;
|
||||
accept_language.join(","sv, ResourceLoader::the().preferred_languages());
|
||||
|
||||
auto header = Infrastructure::Header::from_string_pair("Accept-Language"sv, accept_language.string_view());
|
||||
request.header_list()->append(move(header));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue