src/targets/javascript/fetch/fixtures/full.js
const url = 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value';
const options = {
method: 'POST',
headers: {
cookie: 'foo=bar; bar=baz',
accept: 'application/json',
'content-type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({foo: 'bar'})
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}