uppercase constant
This commit is contained in:
parent
afb9fd8408
commit
c19fe5cffa
@ -65,10 +65,10 @@ class URLEncode extends Operation {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
encodeAllSpecialChars (str) {
|
encodeAllSpecialChars (str) {
|
||||||
const specialChars = "!#'()*-._~";
|
const SPECIAL_CHARS = "!#'()*-._~";
|
||||||
let encoded = "";
|
let encoded = "";
|
||||||
for (const char of str) {
|
for (const char of str) {
|
||||||
if (encodeURIComponent(char) === char && specialChars.includes(char)) {
|
if (encodeURIComponent(char) === char && SPECIAL_CHARS.includes(char)) {
|
||||||
encoded += "%" + this.frontPad(char.charCodeAt(0).toString(16).toUpperCase(), 2, "0");
|
encoded += "%" + this.frontPad(char.charCodeAt(0).toString(16).toUpperCase(), 2, "0");
|
||||||
} else {
|
} else {
|
||||||
encoded += encodeURIComponent(char);
|
encoded += encodeURIComponent(char);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user