RestRequest provides two ways to configure the query parameters for the request: one is by setting the queryItems field, the other is by passing them to one of the func responseXXX(..., queryItems:) functions.
If the queryItems param is not provided, it defaults to nil. However, that then unconditionally overwrites the values on the RestRequest. This seems counter-intuitive, and means the only way to use the currently configured queryItems would be to pass it as a parameter, ie. request.responseObject(..., queryItems: request.queryItems).
This PR makes the overwriting conditional on the queryItems param being non-nil.
Following this change, it is no longer possible to (explicitly or implicitly) pass queryItems: nil to clear the current query parameters. Instead, the user should set request.queryItems = nil before calling a response function.
Resolves #42
RestRequest provides two ways to configure the query parameters for the request: one is by setting the
queryItems
field, the other is by passing them to one of thefunc responseXXX(..., queryItems:)
functions.If the
queryItems
param is not provided, it defaults tonil
. However, that then unconditionally overwrites the values on the RestRequest. This seems counter-intuitive, and means the only way to use the currently configured queryItems would be to pass it as a parameter, ie.request.responseObject(..., queryItems: request.queryItems)
.This PR makes the overwriting conditional on the queryItems param being non-nil.
Following this change, it is no longer possible to (explicitly or implicitly) pass
queryItems: nil
to clear the current query parameters. Instead, the user should setrequest.queryItems = nil
before calling aresponse
function.