Why when I POST the request using fetch not transmitted Cyrillic data?

let userName = 'Yana';
 let text = "text";

 fetch('/chat', {
 headers: {
 "Content-type": "application/x-www-form-urlencoded; charset=UTF-8",
 'body': [text, userName],
 'Content-Type': 'application/json'
 method: 'POST',

On the server:
 console.log('post!!!', req.headers.body);
Res. status(200).send();

At startup, the server does not respond, and the console in the browser this: "chatScript.js:14 Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'Window': Value is not a valid ByteString.
at HTMLSpanElement.buttonSendMe.onclick (chatScript.js:14)".

Here ("HTMLSpanElement.buttonSendMe.onclick") element, clicking on which the script is passed a text string.

If the userName text and the Latin text, then everything is OK...

What to do? How to solve?
June 4th 19 at 16:48
1 answer
June 4th 19 at 16:50
Correct headers, two Content-Type with different quotes and types of the transmitted data suggests that you have copied from somewhere, and besides, body shoved into it in an array.
Here's a piece of working code for post request (and not only):
if (type.toLowerCase() === 'post') {
 params = JSON.stringify(params);

 const fetchOptions = {
 method: type,
 mode: REQUEST_API.mode
 headers: new Headers({
 Accept: 'application/json',
 'Content-Type': 'application/json'
 credentials: REQUEST_API.credentials,
 body: params

return fetch(url, fetchOptions);

params in the post request will be an object with the request body.

If will not help recommended for the inspection of the shape and encoding, using fetch

Find more questions by tags JavaScriptWeb DevelopmentExpress.js