Skip to content

Commit d9e2106

Browse files
committed
add .AspNetCore.Culture header on http requests
1 parent 58b7f63 commit d9e2106

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/abpHttp.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,18 @@ export class AbpHttp extends Http {
269269
}
270270

271271
this.addAuthorizationHeaders(options);
272+
this.addAspNetCoreCultureHeader(options);
272273
this.addAcceptLanguageHeader(options);
273274
this.addTenantIdHeader(options);
274275
}
275276

277+
protected addAspNetCoreCultureHeader(options: RequestOptionsArgs) {
278+
let cookieLangValue = this._utilsService.getCookieValue("Abp.Localization.CultureName");
279+
if (cookieLangValue && options.headers && !options.headers.has('.AspNetCore.Culture')) {
280+
options.headers.append('.AspNetCore.Culture', cookieLangValue);
281+
}
282+
}
283+
276284
protected addAcceptLanguageHeader(options: RequestOptionsArgs) {
277285
let cookieLangValue = this._utilsService.getCookieValue("Abp.Localization.CultureName");
278286
if (cookieLangValue && options.headers && !options.headers.has('Accept-Language')) {

0 commit comments

Comments
 (0)