1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-20 01:46:15 -04:00
elinks/test/ecmascript/assert/fetch.html

23 lines
449 B
HTML
Raw Normal View History

<script>
async function getData() {
const url = "hello.html";
try {
const response = await fetch(url);
if (!response.ok) {
console.error(`Response status: ${response.status}`);
}
const txt = await response.text();
return txt;
} catch (error) {
console.error(error.message);
}
}
console.error("fetch.html");
getData().then(text => {
console.assert(text === 'Hello', 'hello');
console.exit();
});
</script>