diff --git a/mithril.js b/mithril.js index f8a49367..46296502 100644 --- a/mithril.js +++ b/mithril.js @@ -834,7 +834,7 @@ var requestService = function($window, Stream1) { if (xhr.readyState === 4) { try { var response = (args.extract !== extract) ? args.extract(xhr, args) : args.deserialize(args.extract(xhr, args)) - if (xhr.status >= 200 && xhr.status < 300) { + if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) { stream(cast(args.type, response)) } else { diff --git a/mithril.min.js b/mithril.min.js index bc171f33..3a3e7d6b 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -29,14 +29,14 @@ this._state.value&&"function"===typeof this._state.value.toJSON?this._state.valu E=function(b){function f(b,h){if(h instanceof Array)for(var m=0;mb.indexOf("?")?"?":"&";b+=h+f}return b}function k(b){try{return""!==b?JSON.parse(b):null}catch(d){throw Error(b);}}function l(b){return b.responseText}function m(b,d){if("function"===typeof b)if(d instanceof Array)for(var f=0;fn.status)d(m(g.type,b));else{var f=Error(n.responseText),h;for(h in b)f[h]= -b[h];d.error(f)}}catch(k){d.error(k)}"function"===typeof q&&q()}};z?n.send(g.data):n.send();return d},jsonp:function(g){var d=f();void 0!==g.initialValue&&d(g.initialValue);var k=g.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+v++,n=b.document.createElement("script");b[k]=function(f){n.parentNode.removeChild(n);d(m(g.type,f));"function"===typeof q&&q();delete b[k]};n.onerror=function(){n.parentNode.removeChild(n);d.error(Error("JSONP request failed"));"function"===typeof q&&q();delete b[k]}; -null==g.data&&(g.data={});g.url=p(g.url,g.data);g.data[g.callbackKey||"callback"]=k;n.src=h(g.url,g.data);b.document.documentElement.appendChild(n);return d},setCompletionCallback:function(b){q=b}}}(window,N),K=function(){var b=[];return{subscribe:b.push.bind(b),unsubscribe:function(f){f=b.indexOf(f);-1n.status||304===n.status)d(m(g.type,b));else{var f=Error(n.responseText), +h;for(h in b)f[h]=b[h];d.error(f)}}catch(k){d.error(k)}"function"===typeof q&&q()}};z?n.send(g.data):n.send();return d},jsonp:function(g){var d=f();void 0!==g.initialValue&&d(g.initialValue);var k=g.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+v++,n=b.document.createElement("script");b[k]=function(f){n.parentNode.removeChild(n);d(m(g.type,f));"function"===typeof q&&q();delete b[k]};n.onerror=function(){n.parentNode.removeChild(n);d.error(Error("JSONP request failed"));"function"=== +typeof q&&q();delete b[k]};null==g.data&&(g.data={});g.url=p(g.url,g.data);g.data[g.callbackKey||"callback"]=k;n.src=h(g.url,g.data);b.document.documentElement.appendChild(n);return d},setCompletionCallback:function(b){q=b}}}(window,N),K=function(){var b=[];return{subscribe:b.push.bind(b),unsubscribe:function(f){f=b.indexOf(f);-1