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
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.
Description
The default behavior of
WordPressComRestApiappends alocaleparameter to requests. To do so, it inspects & modifies the path of a given request if needed.If a caller were to specify
localein the request parameters, however, the specified value is not properly de-duplicated. For example, composing aGETrequest with the default behavior enabled, passinglocale : fooin 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
URLComponentsfor this purpose.