JSFiddle - React, Tailwind, and code Playground
by Avizura
CSS
input {
display: block;
}
JavaScript
(async () => {
const obj = await fetch('https://kodaktor.ru/j/kramer_data')
.then(res => res.json());
const { url, data } = obj;
let headers = new Headers();
headers.append("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
data.forEach(item => {
fetch(url, {
method: 'POST',
body: item.input,
headers
})
.then(res => res.text())
.then(res => {
let li = document.createElement('li');
li.innerHTML = `expected: ${JSON.stringify(item.output)} actual: ${res}`;
ol.appendChild(li);
});
});
})();
let ol = document.createElement('ol');
document.body.appendChild(ol);