mirror of
https://github.com/bitwarden/browser
synced 2026-02-11 22:13:32 +00:00
Add 'Accept-Language' header to ApiService requests with value obtained from i18nService
This commit is contained in:
@@ -676,6 +676,7 @@ const safeProviders: SafeProvider[] = [
|
||||
LogService,
|
||||
LOGOUT_CALLBACK,
|
||||
VaultTimeoutSettingsServiceAbstraction,
|
||||
I18nServiceAbstraction,
|
||||
],
|
||||
}),
|
||||
safeProvider({
|
||||
|
||||
@@ -127,6 +127,7 @@ import { ProfileResponse } from "../models/response/profile.response";
|
||||
import { UserKeyResponse } from "../models/response/user-key.response";
|
||||
import { AppIdService } from "../platform/abstractions/app-id.service";
|
||||
import { EnvironmentService } from "../platform/abstractions/environment.service";
|
||||
import { I18nService } from "../platform/abstractions/i18n.service";
|
||||
import { LogService } from "../platform/abstractions/log.service";
|
||||
import { PlatformUtilsService } from "../platform/abstractions/platform-utils.service";
|
||||
import { flagEnabled } from "../platform/misc/flags";
|
||||
@@ -168,6 +169,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
private logService: LogService,
|
||||
private logoutCallback: (logoutReason: LogoutReason) => Promise<void>,
|
||||
private vaultTimeoutSettingsService: VaultTimeoutSettingsService,
|
||||
private i18nService: I18nService,
|
||||
private customUserAgent: string = null,
|
||||
) {
|
||||
this.device = platformUtilsService.getDevice();
|
||||
@@ -1594,6 +1596,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
"Bitwarden-Client-Version",
|
||||
await this.platformUtilsService.getApplicationVersionNumber(),
|
||||
);
|
||||
request.headers.set("Accept-Language", await firstValueFrom(this.i18nService.locale$));
|
||||
return this.nativeFetch(request);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user