const body = {
query: `query($test: String) {
something(test: $test) {
a
}
}`,
variables: {
test: 1,
},
};
fetch('url/graphql', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
})
.then((r) => r.json())
.then(console.log);