commercetools / commercetools-postman-collection

Collection of commercetools API examples setup on top of Postman
117 stars 171 forks source link

Auto-encode query parameters #23

Open Hegi opened 4 months ago

Hegi commented 4 months ago

When using the postmen collection, one of the biggest hurdles is that each Query Parameter has to be encoded manually. Now if you only occasionally using the collection it may not seem like a big deal, but having to constantly right click then encode the values can be quite tiresom.

If the collection would contain the bellow snippet, then this encoding would:

And it can be defined on the Project folder, and inherently every request could leverage it.

if (pm.globals.get("PM_DISABLE_AUTO_ENCODE")!=="true") {   
    pm.request.url.query.each((param) => {
        param.value = encodeURIComponent(param.value);
    });
}