Postman URL Encoder
Postman URL Encoder is a NodeJS module that provides various URL encoding related APIs. This module is created to
implement the WHATWG URL specification to remove dependency on Node's URL APIs across
Postman systems. These APIs are useful to encode different parts (like hostname, path, query) of URL and convert
PostmanUrl object into
Node's Url like object.
Installing the Postman URL Encoder
Postman URL Encoder can be installed using NPM or directly from the git repository within your NodeJS projects. If
installing from NPM, the following command installs the module and saves in your package.json
> npm install postman-url-encoder --save
Getting Started
Following example snippet shows how to convert PostmanUrl
object into Node's Url like object.
var PostmanUrl = require('postman-collection').Url,
pmEncoder = require('postman-url-encoder'),
myUrl;
myUrl = new PostmanUrl('http://example.com/p/a/t/h?q1=v1');
myUrl = pmEncoder.toNodeUrl(myUrl));
To know more about provided APIs, head over to Postman URL Encoder Docs.