Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
post(variables = {}) {
const res = http.post('http://localhost:3000/shop-api/', {
query: this.document,
variables: JSON.stringify(variables),
}, {
timeout: 120 * 1000,
});
check(res, {
'Did not error': r => r.json().errors == null && r.status === 200,
});
const result = res.json();
if (result.errors) {
fail('Errored: ' + result.errors[0].message);
}
return res.json();
}
}