mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-21 17:33:29 +01:00
Fix bug where langs incorrectly determined in smapi
This commit is contained in:
@@ -22,7 +22,7 @@ import { AccessTokens } from "./access_tokens";
|
|||||||
import { BONOB_ACCESS_TOKEN_HEADER } from "./server";
|
import { BONOB_ACCESS_TOKEN_HEADER } from "./server";
|
||||||
import { Clock } from "./clock";
|
import { Clock } from "./clock";
|
||||||
import { URLBuilder } from "./url_builder";
|
import { URLBuilder } from "./url_builder";
|
||||||
import { I8N, LANG } from "./i8n";
|
import { asLANGs, I8N } from "./i8n";
|
||||||
|
|
||||||
export const LOGIN_ROUTE = "/login";
|
export const LOGIN_ROUTE = "/login";
|
||||||
export const CREATE_REGISTRATION_ROUTE = "/registration/add";
|
export const CREATE_REGISTRATION_ROUTE = "/registration/add";
|
||||||
@@ -537,10 +537,10 @@ function bindSmapiSoapServiceToExpress(
|
|||||||
.then(({ musicLibrary, accessToken, type, typeId }) => {
|
.then(({ musicLibrary, accessToken, type, typeId }) => {
|
||||||
const paging = { _index: index, _count: count };
|
const paging = { _index: index, _count: count };
|
||||||
const acceptLanguage = headers["accept-language"];
|
const acceptLanguage = headers["accept-language"];
|
||||||
const lang = i8n((acceptLanguage || "en-US") as LANG);
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
`Fetching metadata type=${type}, typeId=${typeId}, acceptLanguage=${acceptLanguage}`
|
`Fetching metadata type=${type}, typeId=${typeId}, acceptLanguage=${acceptLanguage}`
|
||||||
);
|
);
|
||||||
|
const lang = i8n(...asLANGs(acceptLanguage));
|
||||||
|
|
||||||
const albums = (q: AlbumQuery): Promise<GetMetadataResponse> =>
|
const albums = (q: AlbumQuery): Promise<GetMetadataResponse> =>
|
||||||
musicLibrary.albums(q).then((result) => {
|
musicLibrary.albums(q).then((result) => {
|
||||||
|
|||||||
@@ -758,7 +758,7 @@ describe("api", () => {
|
|||||||
|
|
||||||
describe("when an accept-language header is present with value nl-NL", () => {
|
describe("when an accept-language header is present with value nl-NL", () => {
|
||||||
it("should return nl-NL", async () => {
|
it("should return nl-NL", async () => {
|
||||||
ws.addHttpHeader("accept-language", "nl-NL")
|
ws.addHttpHeader("accept-language", "nl-NL, en-US;q=0.9")
|
||||||
const root = await ws.getMetadataAsync({
|
const root = await ws.getMetadataAsync({
|
||||||
id: "root",
|
id: "root",
|
||||||
index: 0,
|
index: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user