Skip to content

Commit

Permalink
Merge pull request #1182 from nathanfaucett/master
Browse files Browse the repository at this point in the history
Cannot read property x-ua-compatible of null
  • Loading branch information
maksimr committed Sep 28, 2014
2 parents 709fe6d + 72452e9 commit f72d08f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/middleware/karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@

var path = require('path');
var util = require('util');
var urlparse = require('url').parse;
var url = require('url');

var urlparse = function(urlStr) {
var urlObj = url.parse(urlStr, true);
urlObj.query = urlObj.query || {};
return urlObj;
};

var common = require('./common');

Expand All @@ -36,7 +42,7 @@ var filePathToUrlPath = function(filePath, basePath) {

var getXUACompatibleMetaElement = function(url) {
var tag = '';
var urlObj = urlparse(url, true);
var urlObj = urlparse(url);
if (urlObj.query['x-ua-compatible']) {
tag = '\n<meta http-equiv="X-UA-Compatible" content="' +
urlObj.query['x-ua-compatible'] + '"/>';
Expand All @@ -46,7 +52,7 @@ var getXUACompatibleMetaElement = function(url) {

var getXUACompatibleUrl = function(url) {
var value = '';
var urlObj = urlparse(url, true);
var urlObj = urlparse(url);
if (urlObj.query['x-ua-compatible']) {
value = '?x-ua-compatible=' + encodeURIComponent(urlObj.query['x-ua-compatible']);
}
Expand Down

0 comments on commit f72d08f

Please sign in to comment.