Commit 74733cb2 authored by yPhil's avatar yPhil
Browse files

Request syntax response tests

parent c3ddcc8f
......@@ -81,10 +81,22 @@ module.exports = function(url, searchPrefix, callback) {
};
function does_it_render(url, callback) {
// request
// .get(url)
// .on('response', function(response) {
// console.log(response.statusCode) // 200
// console.log(response.headers['content-type']) // 'image/png'
// })
// .on('error', function(err) { // <------- add this
// console.log(err)
// });
request(url, function(err, res, body) {
if (err || !body || body === '' || !res.headers['content-type'].includes('xml')) {
return callback(err);
}
callback(null, res.statusCode < 300 && res.headers['content-type'].includes('xml'));
});
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment