gistlib
Here are examples of making an HTTP OPTIONS request in JavaScript using different libraries:
Using XMLHttpRequest:
index.tsxconst xhr = new XMLHttpRequest(); xhr.open('OPTIONS', 'https://example.com/api'); xhr.send(); 94 chars4 lines
const xhr = new XMLHttpRequest(); xhr.open('OPTIONS', 'https://example.com/api'); xhr.send();
Using fetch:
index.tsxfetch('https://example.com/api', { method: 'OPTIONS' }); 59 chars4 lines
fetch('https://example.com/api', { method: 'OPTIONS' });
Using axios:
index.tsxaxios.options('https://example.com/api'); 42 chars2 lines
axios.options('https://example.com/api');
gistlibby LogSnag