Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function bodyMethods() {
console.log('with fetch');
let response = await fetch('http://localhost:8080/simple-get');
let body = await response.text();
console.log('body: ', body);
console.log('without body method');
response = await ky('http://localhost:8080/simple-get');
body = await response.text();
console.log('body: ', body);
console.log('without body method');
response = await ky.get('http://localhost:8080/simple-get');
body = await response.text();
console.log('body: ', body);
console.log('with json()');
body = await ky.get('http://localhost:8080/simple-get').json();
console.log('body: ', body);
console.log('with text()');
body = await ky.get('http://localhost:8080/simple-get').text();
console.log('body: ', body);