JSFiddle - React, Tailwind, and code Playground
by Vladymyr Shevchuk
JavaScript
const readableStream = new ReadableStream({
start(controller) {
controller.enqueue(new TextEncoder().encode('hello'));
controller.close();
}
});
post(readableStream);
function post(postBody) {
fetch('https://dev.anthum.com/post-test/', {
body: postBody,
headers: {'content-type': 'text/plain'},
method: 'POST'
})
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.error(error));
}