cURL request responds with result but nodejs request says “Enable javascript and cookies to continue”

I am making this cURL request below which responds with the right results from my terminal. However, the same url says “Enable Javascript and cookies to continue.” when using the curl in a VM, postman and nodejs request.

curl --location 'https://leetcode.com/contest/api/ranking/weekly-contest-388?pagination=1' 
--header 'Referer: https://leetcode.com/contest/weekly-contest-388/ranking/' 
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36' 
--header 'DNT: 1'

Node.js request looks like below.

var request = require('request');

var headers = {
    'Referer': 'https://leetcode.com/contest/weekly-contest-388/ranking/',
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',
    'DNT': '1'
};

var options = {
    url: 'https://leetcode.com/contest/api/ranking/weekly-contest-388?pagination=1',
    headers: headers
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

I got this API from the contest ranking page on Leetcode. https://leetcode.com/contest/weekly-contest-388/ranking/

What am I missing or doing wrong? My main aim is to use it in node.js request and I used postman just to debug and better understand the API call.