I am using mocha for getting the response of this API: "http://reqres.in/api/users?page=1"
I am getting a response when I use this request in POSTMAN:
However when using the same request in mocha to get a response (token in this case). I am getting an empty reponse. Below is the code I wrote and the output in Terminal:
const mocha = require ('mocha');
const should = require ('should');
const supertest = require('supertest');
let baseUrl = supertest("http://reqres.in/");
let listUserEndPoint = 'api/users?page=1';
it("List User", async function() {
let res = await baseUrl.get(listUserEndPoint)
.set('Content-Type', 'application/json') // Setting the content type as header
console.log(res.body);
});
Can someone help me out, what I am doing wrong?