I have the following fetch request made via Chrome's DevTools:
fetch("https://www.example.com", {
"headers": {
"accept": "*/*",
"accept-language": "en-US,en;q=0.9,he;q=0.8",
"content-type": "application/x-www-form-urlencoded",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"x-requested-with": "XMLHttpRequest"
},
"referrer": "",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": "message=hey",
"method": "POST",
"mode": "cors",
"credentials": "include"
});
Now, as you can see, we have a "body" parameter with message=hey.
I am trying to get the message to say "hi" in HTML character codes, which should be like this:
hi
I need to send those HTML character code letters exactly as is with my request, but the problem is, it has symbols that break the syntax of JSON, like "&". so, how can I fix this problem?
h
see that amp? why does it happen? – RunningFromShia Oct 12 '20 at 15:38h
see that amp? it wasn't supposed to be there, it breaks the html character code. – RunningFromShia Oct 12 '20 at 16:06h
` into the page it would display as just `h` (`` is "invisible" and adds a paragraph, `&` is an HTML encoded character and will be decoded to `&`).
– 3limin4t0r Oct 12 '20 at 16:22