Modify locale handling to inspect request parameters
Opened this issue · 0 comments
Deleted user commented
Description
The default behavior of WordPressComRestApi
appends a locale
parameter to requests. To do so, it inspects & modifies the path of a given request if needed.
If a caller were to specify locale
in the request parameters, however, the specified value is not properly de-duplicated. For example, composing a GET
request with the default behavior enabled, passing locale : foo
in the request parameters evinces a request with the following URL : https://public-api.wordpress.com/wpcom/v2/<path>?locale=en&locale=foo
.
Potential Solution
The client should inspect the parameters associated with the request, and de-duplicate those if necessary. It might be worth using URLComponents
for this purpose.