MCPcopy Create free account
hub / github.com/Kong/insomnia / encodeEncoding

Function encodeEncoding

packages/insomnia/src/common/templating/utils.ts:115–130  ·  view source on GitHub ↗
(value: T, encoding?: 'base64')

Source from the content-addressed store, hash-verified

113}
114
115export function encodeEncoding<T>(value: T, encoding?: 'base64') {
116 if (typeof value !== 'string') {
117 return value;
118 }
119
120 if (value.length === 0) {
121 return value;
122 }
123
124 if (encoding === 'base64') {
125 const encodedValue = utf8ToBase64(value);
126 return `b64::${encodedValue}::46b`;
127 }
128
129 return value;
130}
131
132export function decodeEncoding<T>(value: T) {
133 if (typeof value !== 'string') {

Callers

nothing calls this directly

Calls 1

utf8ToBase64Function · 0.90

Tested by

no test coverage detected