I\'m attempting to build an automated test with Nightwatch.js in order to verify that software download links are working correctly. I don\'t want to download the files, as
http module and make a "HEAD" requesttest.js
var http = require("http");
module.exports = {
"Is file avaliable" : function (client) {
var request = http.request({
host: "www.google.com",
port: 80,
path: "/images/srpr/logo11w.png",
method: "HEAD"
}, function (response) {
client
.assert.equal(response.headers["content-length"], 14022, 'Same file size');
client.end();
}).on("error", function (err) {
console.log(err);
client.end();
}).end();
}
};
References