HTTPS: Difference between revisions

204 bytes added ,  6 months ago
imported>Marwal
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) {
Anonymous user