This is my code:
const result = await axios({
url: "https://exampleurl.com",
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
data: {
query: `query {
footer {
title
}
}`,
},
})
There are no variables required for this call.
So this gives me 400 which makes me think there is something wrong with my body payload? But I can't see anything wrong with it. Maybe I am blind.
I have also tried stringifying the data object like this:
JSON.stringify({
query: `query {
footer {
title
}
}`,
}),
But then I get this error:
"stack": "TypeError: Converting circular structure to JSON\n -->
starting at object with constructor 'ClientRequest'\n | property
'socket' -> object with constructor 'Socket'\n --- property
'_httpMessage' closes the circle\n at JSON.stringify
I have checked out other similar posts but can't seem to fix this issue.