function escapeHeaderValue(string, alwaysEncode = "") {
    return [...string]
        .map((codePointString) => {
        var _a;
        if (!alwaysEncode.includes(codePointString) && codePointString !== "%") {
            let codePoint = (_a = codePointString.codePointAt(0)) !== null && _a !== void 0 ? _a : 0;
            if (codePoint >= 33 && codePoint <= 126) {
                return codePointString;
            }
            if (RFC7320_WHITESPACE.includes(codePointString)) {
                return codePointString;
            }
        }
        return encodeURIComponent(codePointString);
    })
        .join("");
}
// The specification (rfc7320) allows octets 33-126 and whitespace. Octets 128-255 have been deprecated since rfc2616.
The specification (rfc7320) allows octets 33-126 and whitespace. Octets 128-255 have been deprecated since rfc2616.
The specification ( rfc7320 ) allows octets 33 - 126 and whitespace . Octets 128 - 255 have been deprecated since rfc2616 .
function escapeHeaderValue(string, alwaysEncode = "") {
    return [...string]
        .map((codePointString) => {
        var _a;
        if (!alwaysEncode.includes(codePointString) && codePointString !== "%") {
            let codePoint = (_a = codePointString.codePointAt(0)) !== null && _a !== void 0 ? _a : 0;
            if (codePoint >= 33 && codePoint <= 126) {
                return codePointString;
            }
            if (RFC7320_WHITESPACE.includes(codePointString)) {
                return codePointString;
            }
        }
        return encodeURIComponent(codePointString);
    })
        .join("");
}
function escapeHeaderValue ( string , alwaysEncode = "" ) { return [ ... string ] . map ( ( codePointString ) => { var _a ; if ( ! alwaysEncode . includes ( codePointString ) && codePointString !== "%" ) { let codePoint = ( _a = codePointString . codePointAt ( 0 ) ) !== null && _a !== void 0 ? _a : 0 ; if ( codePoint >= 33 && codePoint <= 126 ) { return codePointString ; } if ( RFC7320_WHITESPACE . includes ( codePointString ) ) { return codePointString ; } } return encodeURIComponent ( codePointString ) ; } ) . join ( "" ) ; }
The specification (rfc7320) allows octets 33-126 and whitespace.
The specification ( rfc7320 ) allows octets 33 - 126 and whitespace .