Hey,
I’ve been developing an external datastore system using the App Engine with Google Cloud.
I used this code to make a POST request
local HTTPService = game:GetService("HttpService")
print(HTTPService:RequestAsync({
Url = "https://censored.com/data/post",
Method = "POST",
Headers = {
["api-token"] = "censored",
["Content-Type"] = "application/json"
},
Body = HTTPService:JSONEncode({
UID = "64881507"
})
}))
And here is the code that I use on my node.js backend:
REST_API.post('/data/post', (Request, Response) => {
console.log(Request)
if (Request.headers['api-token'] == API_Token) {
if (Request.body != null) {
Response.status(200).send(upsertUser(Request.body.UID, Request.body.Points));
} else {
Response.status(400).send('Please provide a body!')
}
}
Response.status(401).send('Unauthorized.');
});
For some reason when I make a POST request, the backend sends status code 400:
Does anyone know what is happening here and why it seems like the Body
isn’t getting sent?