postman-url-encoder

Implementation of the WHATWG URL Standard

Apache-2.0 22 个版本
安装
npm install postman-url-encoder
yarn add postman-url-encoder
pnpm add postman-url-encoder
bun add postman-url-encoder
README

Postman URL Encoder Build Status codecov

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;

// Create PostmanUrl object
myUrl = new PostmanUrl('http://example.com/p/a/t/h?q1=v1');

// convert PostmanUrl object to Node's Url like object
myUrl = pmEncoder.toNodeUrl(myUrl));
// {
//   protocol: 'http:',
//   slashes: true,
//   auth: null,
//   host: 'example.com',
//   port: null,
//   hostname: 'example.com',
//   hash: null,
//   search: '?q1=v1',
//   query: 'q1=v1',
//   pathname: '/p/a/t/h',
//   path: '/p/a/t/h?q1=v1',
//   href: 'http://example.com/p/a/t/h?q1=v1'
// }

To know more about provided APIs, head over to Postman URL Encoder Docs.

版本列表
3.0.8 2025-09-05
3.0.7 2025-03-27
3.0.6 2025-02-21
3.0.5 2021-08-16
3.0.4 2021-08-09
3.0.3 2021-07-25
3.0.2 2021-07-14
3.0.1 2021-01-02
3.0.0-beta.1 2020-10-04
3.0.0 2020-10-04
2.1.3 2020-07-29
2.1.2 2020-07-13
2.1.1 2020-03-15
2.1.0-beta.3 2020-02-26
2.1.0-beta.2 2020-02-14
2.1.0-beta.1 2020-02-13
2.1.0 2020-03-02
2.0.0 2020-02-06
1.0.3 2019-10-16
1.0.2 2019-04-08
1.0.1 2017-02-01
1.0.0 2017-02-01