DEP0076: tls.parseCertString()


类型: 运行时

tls.parseCertString() 是简单的解析助手,被错误地公开了。 此函数通常可以替换为:

const querystring = require('querystring');
querystring.parse(str, '\n', '=');

此函数不完全等同于 querystring.parse()。 一个区别是 querystring.parse() 做 url 解码:

> querystring.parse('%E5%A5%BD=1', '\n', '=');
{ '好': '1' }
> tls.parseCertString('%E5%A5%BD=1');
{ '%E5%A5%BD': '1' }

Type: Runtime

tls.parseCertString() is a trivial parsing helper that was made public by mistake. This function can usually be replaced with:

const querystring = require('querystring');
querystring.parse(str, '\n', '=');

This function is not completely equivalent to querystring.parse(). One difference is that querystring.parse() does url decoding:

> querystring.parse('%E5%A5%BD=1', '\n', '=');
{ '好': '1' }
> tls.parseCertString('%E5%A5%BD=1');
{ '%E5%A5%BD': '1' }