Commit 4b867ea3 4b867ea30c4df38160aa3e2f2557554085df4bf1 by Oleg Pudeyev

Check that user-agent header exists before retrieving it

1 parent 661c77ec
...@@ -7,9 +7,11 @@ function testUA(ua, match) { ...@@ -7,9 +7,11 @@ function testUA(ua, match) {
7 } 7 }
8 8
9 function fetchUA(request) { 9 function fetchUA(request) {
10 testUA(request.headers.filter(function(header) { 10 var headers = request.headers.filter(function(header) {
11 return header.name === "User-Agent"; 11 return header.name === "User-Agent";
12 }).pop().value, /plop/); 12 });
13 casper.test.assert(headers.length > 0);
14 testUA(headers.pop().value, /plop/);
13 } 15 }
14 16
15 casper.test.begin('userAgent() tests', 2, function(test) { 17 casper.test.begin('userAgent() tests', 2, function(test) {
......