HTTPS: Difference between revisions
Content added Content deleted
imported>Marwal m (→{{header|D}}) |
imported>Gabrielsroka |
||
Line 381: | Line 381: | ||
=={{header|JavaScript}}== |
=={{header|JavaScript}}== |
||
=== Browser === |
=== 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) { |
<syntaxhighlight lang="javascript">fetch("https://sourceforge.net").then(function (response) { |
||
return response.text(); |
return response.text(); |
||
Line 386: | Line 395: | ||
return body; |
return body; |
||
});</syntaxhighlight> |
});</syntaxhighlight> |
||
=== Node.js === |
=== Node.js === |
||
<syntaxhighlight lang="javascript">require("https").get("https://sourceforge.net", function (resp) { |
<syntaxhighlight lang="javascript">require("https").get("https://sourceforge.net", function (resp) { |