You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.
We use capacitor and this http plugin in an angular application. The Accept-Language header is set on the request (Http.request()), but when it is sent to the server we see additional languages in this header, not just the one we set.
I found that CapacitorUrlRequest initializes the Accept-Language header based on some device settings. Later when setRequestHeaders() is called it appends the parameter headers to the existing ones, not overwrites them. This means that the parameter language for the Accept-Language header will be the last language in the header, and because the first one has a quality value of 1 (as the default), our language can never have a higher priority than that.
I beleive calling request.setValue() instead of the current request.addValue() would solve this problem. URLRequest docs
As an additional info the java code for android overwrites the headers in CapacitorHttpUrlConnection.setRequestHeaders().
The text was updated successfully, but these errors were encountered:
We use capacitor and this http plugin in an angular application. The Accept-Language header is set on the request (
Http.request()
), but when it is sent to the server we see additional languages in this header, not just the one we set.I found that
CapacitorUrlRequest
initializes the Accept-Language header based on some device settings. Later whensetRequestHeaders()
is called it appends the parameter headers to the existing ones, not overwrites them. This means that the parameter language for the Accept-Language header will be the last language in the header, and because the first one has a quality value of 1 (as the default), our language can never have a higher priority than that.I beleive calling
request.setValue()
instead of the currentrequest.addValue()
would solve this problem. URLRequest docsAs an additional info the java code for android overwrites the headers in
CapacitorHttpUrlConnection.setRequestHeaders()
.The text was updated successfully, but these errors were encountered: