Anonymous user
HTTPS: Difference between revisions
→Browser
imported>Marwal m (→{{header|D}}) |
imported>Gabrielsroka |
||
Line 381:
=={{header|JavaScript}}==
=== Browser ===
Using fetch API and async/await:
<syntaxhighlight lang="javascript">
const response = await fetch('https://rosettacode.org');
const text = await response.text();
console.log(text);
</syntaxhighlight>
<syntaxhighlight lang="javascript">fetch("https://sourceforge.net").then(function (response) {
return response.text();
Line 386 ⟶ 395:
return body;
});</syntaxhighlight>
=== Node.js ===
<syntaxhighlight lang="javascript">require("https").get("https://sourceforge.net", function (resp) {
|