Created
March 19, 2023 08:37
-
-
Save SBajonczak/17c145f973aa34d8d65dd40b7259496d to your computer and use it in GitHub Desktop.
Making http3 call
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('https://example.com/api', { | |
method: 'GET', | |
headers: { | |
'Accept': 'application/json', | |
'Content-Type': 'application/json' | |
}, | |
protocol: 'http3', | |
}) | |
.then(response => { | |
if (!response.ok) { | |
throw new Error('Network response was not ok'); | |
} | |
return response.json(); | |
}) | |
.then(data => { | |
console.log(data); | |
}) | |
.catch(error => { | |
console.error('There was a problem with the fetch operation:', error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment