oauth-1.0a icon indicating copy to clipboard operation
oauth-1.0a copied to clipboard

Remove empty keys

Open Cyclonecode opened this issue 4 years ago • 0 comments

I was using this package for to handle oauth and making rest api requests to magento. In the filters to the endpoint I had a trailing & which made the request fail, so thought it would be a good idea to actually remove all empty parameters e.g

    const searchCriteria =
      'searchCriteria[filter_groups][0][filters][0][field]=entity_id&' +
      'searchCriteria[filter_groups][0][filters][0][value]=' + id + '&' +
      'searchCriteria[filter_groups][1][filters][0][field]=status&' +
      'searchCriteria[filter_groups][1][filters][0][value]=1&';

Here I really would like to remove the trailing &.

Cyclonecode avatar Jul 12 '19 15:07 Cyclonecode