So I'm using node.js to get info from an API, then sending the response from the API back (mainly to get around cross origin and that fun stuff), so I was wondering how I would check if the response from the API is a certain string? For example, if you put in an invalid username in the api it returns an empty object, which if you do object.toString() it should be {} (I think?), so I was wondering how I would do an if statement checking if the APIs response is {} (something like if(object.toString() = "{}" { do stuff }?)
Here's my code:
app.get('/stats/id64/:steamid64', function(httpRequest, httpResponse) {
    var url = '<api link>&steamid=' +
        httpRequest.params.steamid64;
    request.get(url, function(error, steamHttpResponse, steamHttpBody) {
        httpResponse.setHeader('Content-Type', 'application/json');
        var response = {isValidUser: 'false'};
        if(steamHttpBody.toString() == "{}") {
            httpResponse.send(response);
        } else {
            httpResponse.send(steamHttpBody);
        }
    });
});
Any help is appreciated :)
 
     
    