Rank 1: Thread
Hi guys, what am I doing wrong?
I am sending the postman request to my function. The header contains only a content-type = application/json; charset=UTF-8.
From this request and receive a 500 internal server error.
Here is the function:
String requestBody = jsonEncode(context.req.body);
context.log(requestBody);
String userId = context.req.body['user_id'];
context.log(context.req.body['text']);
if (await userExists(userId)) {
List? response = await getStatusCode(context.req.body['text']);
return context.res.json({'status': response![0], 'text': response[1]});
} else {
return context.res.json({'status': 400, 'text': 'User does not exist'});
}
The requestBody variable is an empty string "". Why?