bdkjones/CodeKit — Issue #213: XHR response header with null content-type error
Author: bmoeskau
Created: 2012-02-20 07:30:53+00:00
State: open

I'm getting a particular javascript file include that results in "content-type" coming across with a null value. This block of code properly checks for that case before processing the regex:

for (var h in headers) {
var value = xhr.getResponseHeader(h);
if (h.toLowerCase() == 'content-type' && value) value = value.replace(/^(.*?);.*?$/i, '$1');
info[h] = value;
}

However, info[h] still gets set with value = null. Once it lands in the following code it produces a null error:

var Live = {

refreshResource: function (url, type) {
switch (type.toLowerCase()) { // <------ type is null

Now obviously I need to check out why my one JS file does not seem to have a content-type set, but I think this code should check for this case to avoid locking up the browser (this forces me to completely kill the active tab).