I am working on a wrapper for the graphql endpoint for Deno, but all of my requests are receiving Bad Request 400
errors when using the fetch
api. Here is how my fetch requests are setup:
fetch("https://graphql.fauna.com/graphql" {
headers: {
accept: "application/json",
authorization: "Bearer <key>",
method: "POST",
"Content-Type": "application/json"
},
body: 'query { \n allProducts { \n data { \n name \n quantity \n description \n } \n } \n }'
);
Is there anyone who can tell me what I am doing wrong, because I am clueless…
Edit: I am using the demo data preset that FaunaDB allowed me to use at the setup options page.