Skip to content

Instantly share code, notes, and snippets.

@SBajonczak
Created March 19, 2023 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SBajonczak/17c145f973aa34d8d65dd40b7259496d to your computer and use it in GitHub Desktop.
Save SBajonczak/17c145f973aa34d8d65dd40b7259496d to your computer and use it in GitHub Desktop.
Making http3 call
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