JSFiddle - React, Tailwind, and code Playground

by Vladymyr Shevchuk

JavaScript

// String test - passes
//post('hello');

// ReadableStream test - fails
post(new ReadableStream());

// Server should respond with postBody text value, indicating it was sent and received.
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', data))
  .catch(error => console.error('error', error));
}