The defaultLanguage parameter applied in the client should be overwritten when another language parameter is applied to an individual query, instead they are both applied
Repro steps
Instantiate a delivery client in a local JS environment
Add defaultLanguage: 'yourLanguageCodename' to the client
Create a query with languageParameter of another language applied
Send request and check URL value of the response object to see that both language parameters have been added.
Brief bug description
The
defaultLanguage
parameter applied in the client should be overwritten when another language parameter is applied to an individual query, instead they are both appliedRepro steps
Instantiate a delivery client in a local JS environment Add
defaultLanguage: 'yourLanguageCodename'
to the client Create a query withlanguageParameter
of another language applied Send request and check URL value of the response object to see that both language parameters have been added.My example:
Expected behavior
The Language Parameter on the query level should overwrite the default language, and the URL should only contain the single language parameter
Test environment
Node.js v 18.16.0
Additional context
I believe the issue is stemming from this: https://github.com/kontent-ai/delivery-sdk-js/blob/master/lib/query/common/base-query.class.ts#L119-L128C6
Specifically line 122, the
.find()
predicate will never return true, since the result ofthis.getParameters()
isn't exactly equal to 'language'