From ec1e5f8394566647a2e9bf920064310df2f4c498 Mon Sep 17 00:00:00 2001 From: Mykola Date: Sat, 30 Sep 2017 02:44:48 +0300 Subject: [PATCH] Fix XHR.getAllResponseHeaders The XHR-specification changed to lowercase all their headers also in HTTP/1.1. Chrome (60) is the first one who changed this, but patches for Gecko/Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=1370485) and Webkit/Safari are already avaialble --- .../Scripts/datajs-0.0.2.js | 18 +++++++++--------- .../Scripts/datajs-0.0.2.min.js | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/ODataValidationService/Scripts/datajs-0.0.2.js b/src/ODataValidationService/Scripts/datajs-0.0.2.js index 3933014..e2d4765 100644 --- a/src/ODataValidationService/Scripts/datajs-0.0.2.js +++ b/src/ODataValidationService/Scripts/datajs-0.0.2.js @@ -444,7 +444,7 @@ /// HTTP request with response available. /// Target array to fill with name/value pairs. - var responseHeaders = xhr.getAllResponseHeaders().split(/\r?\n/); + var responseHeaders = xhr.getAllResponseHeaders().toLowerCase().split(/\r?\n/); var i, len; for (i = 0, len = responseHeaders.length; i < len; i++) { if (responseHeaders[i]) { @@ -544,7 +544,7 @@ name = "handleJSONP_" + tickText; window[name] = function (data) { removeCallback(name, tick); - success({ body: data, statusCode: 200, headers: { "Content-Type": "application/json"} }); + success({ body: data, statusCode: 200, headers: { "content-type": "application/json"} }); }; var scriptTag = document.createElement("SCRIPT"); @@ -673,7 +673,7 @@ /// Object representing a request or a response. /// Object with 'mediaType' and a 'properties' dictionary; null in case that the header is not found or doesn't have a value. - return contentType(getRequestOrResponseHeader(requestOrResponse, "Content-Type")); + return contentType(getRequestOrResponseHeader(requestOrResponse, "content-type")); }; var getDataServiceVersion = function (requestOrResponse) { @@ -747,8 +747,8 @@ request.body = serializeCallback(handler, request.data, writeContext); if (request.body) { - fixRequestHeader(request, "DataServiceVersion", writeContext.dataServiceVersion || "1.0"); - fixRequestHeader(request, "Content-Type", contentTypeToString(writeContext.contentType)); + fixRequestHeader(request, "dataserviceversion", writeContext.dataServiceVersion || "1.0"); + fixRequestHeader(request, "content-type", contentTypeToString(writeContext.contentType)); return true; } } @@ -3513,7 +3513,7 @@ /// Response object. /// Operation context. - if (response && response.body !== null && response.body !== undefined && response.headers["Content-Type"]) { + if (response && response.body !== null && response.body !== undefined && response.headers["content-type"]) { dispatchHandler("read", response, context); } }, @@ -3620,7 +3620,7 @@ while (partEnd !== "--" && context.position < text.length) { var partHeaders = readHeaders(text, context); - var partContentType = contentType(partHeaders["Content-Type"]); + var partContentType = contentType(partHeaders["content-type"]); if (partContentType && partContentType.mediaType === batchMediaType) { context.boundaries.push(partContentType.properties["boundary"]); @@ -3806,7 +3806,7 @@ } var changeSetBoundary = createBoundary("changeset_"); - result = "Content-Type: " + batchMediaType + "; boundary=" + changeSetBoundary + "\r\n"; + result = "content-type: " + batchMediaType + "; boundary=" + changeSetBoundary + "\r\n"; var i, len; for (i = 0, len = changeSet.length; i < len; i++) { result += writeBatchPartDelimiter(changeSetBoundary, false) + @@ -3815,7 +3815,7 @@ result += writeBatchPartDelimiter(changeSetBoundary, true); } else { - result = "Content-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\n"; + result = "content-type: application/http\r\ncontent-transfer-encoding: binary\r\n\r\n"; prepareRequest(part, partHandler(context), { metadata: context.metadata }); result += writeRequest(part); } diff --git a/src/ODataValidationService/Scripts/datajs-0.0.2.min.js b/src/ODataValidationService/Scripts/datajs-0.0.2.min.js index 3441252..c0cbf13 100644 --- a/src/ODataValidationService/Scripts/datajs-0.0.2.min.js +++ b/src/ODataValidationService/Scripts/datajs-0.0.2.min.js @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -(function(e,b){if(!e.OData)e.OData={};var c=e.OData,vb=function(a,c,d){if(!a.method)a.method="GET";if(!a.headers)a.headers={};if(a.headers.Accept===b)a.headers.Accept=c.accept;a.data&&a.body===b&&c.write(a,d)},Ic=function(a,g,c,f,d,e){d.request(a,function(d){try{d.data===b&&f.read(d,e);g(d.data,d)}catch(h){if(h.request===b)h.request=a;if(h.response===b)h.response=d;c(h)}},c)},d={feed:"feed",entry:"entry",svcDoc:"service document",complexType:"complex",primitiveType:"primitive",batch:"batch",unknown:"unknown",none:"none"},h={complex:"complex",deferred:"deferred",inline:"inline",primitive:"primitive",none:"none"},cd=function(b,d){var a,c;for(a=0,c=b.length;a=200&&d<=299)i(f);else h({message:"HTTP request failed",request:c,response:f})};a.open(c.method||"GET",b,true);if(c.headers)for(d in c.headers)a.setRequestHeader(d,c.headers[d]);if(c.timeoutMS){a.timeout=c.timeoutMS;a.ontimeout=function(){if(a){a=null;h({message:"Request timed out"})}}}a.send(c.body)}else{if(!Sc(c))throw{message:"Request is not local and cannot be done through JSONP."};var m=F;F+=1;var n=m.toString();d="handleJSONP_"+n;e[d]=function(a){Hc(d,m);i({body:a,statusCode:200,headers:{"Content-Type":"application/json"}})};var g=document.createElement("SCRIPT");g.setAttribute("type","text/javascript");var f=this.callbackParameterName+"="+d;if(this.formatQueryString)f+="&"+this.formatQueryString;var j=b.indexOf("?");if(j===-1)b=b+"?"+f;else if(j===b.length-1)b=b+f;else b=b+"&"+f;g.setAttribute("src",b);var l=document.getElementsByTagName("HEAD")[0];l.appendChild(g);l=g=null}return k}};var v=function(f){if(!f)return null;var b=f.split(";"),d={},a,e;for(a=1,e=b.length;a=0},Tc=function(c,h,a,f){if(!a||!a.headers)return false;var g=tb(a),i=fb(a)||"",d=a.body;if(d===b||d===null)return false;if(ub(c,g)){var e=cb(g,i,f?f.metadata:null,c);e.response=a;a.data=h(c,d,e);return a.data&&true}return false},Mc=function(c,f,a,e){if(!a||!a.headers)return false;var d=tb(a),g=fb(a);if(!d||ub(c,d)){var b=cb(d,g,e?e.metadata:null,c);b.request=a;a.body=f(c,a.data,b);if(a.body){lb(a,"DataServiceVersion",b.dataServiceVersion||"1.0");lb(a,"Content-Type",lc(b.contentType));return true}}return false},C=function(c,b,d,a){return{accept:d,maxDataServiceVersion:a,read:function(a,b){return Tc(this,c,a,b)},write:function(c,a){return Mc(this,b,c,a)}}},Qc="application/xml",ed=/^([^:/?#]+:)?(\/\/[^/?#]*)?([^?#:]+)?(\?[^#]*)?(#.*)?/,Ob="http://",G=Ob+"www.w3.org/",x=Ob+"schemas.microsoft.com/ado/",E=x+"2007/08/dataservices",R=G+"2000/xmlns/",Nb=G+"XML/1998/namespace",Lb=x+"2007/06/edmx",hd=x+"2008/09/edm",fd=x+"2006/04/edm",gd=x+"2007/05/edm",f=G+"2005/Atom",w=G+"2007/app",n=E,g=E+"/metadata",M=E+"/related/",Eb=E+"/scheme",Db=["scheme","authority","path","query","fragment"],Hb=function(e){var b={isAbsolute:false};if(e){var c=ed.exec(e);if(c){var a,d;for(a=0,d=Db.length;a",f=a.parse(g,null),e=c.ownerDocument.importNode(f.domNode,true),b=e.firstChild;while(b){c.appendChild(b);b=b.nextSibling}},appendPreserving:function(a,b){Rb(b)&&a.setAttribute("xml:space","preserve");var c=a.ownerDocument.createTextNode(b);a.appendChild(c)},attributes:function(f,e){var b,c=f.domNode,a,d;for(a=0,d=c.attributes.length;a4)throw{message:"Cannot parse date/time value to given precision."};while(b.length<4)b+="0";b=parseInt(b.substring(1),10)}var j=parseInt(a[4],10),i=parseInt(a[5],10),k=parseInt(a[6],10);if(d!=="Z"){var e=yb(d),h=-e.d;j+=e.h*h;i+=e.m*h}var c=new Date;c.setUTCFullYear(f,parseInt(a[2],10)-1,parseInt(a[3],10));c.setUTCHours(j,i,k,b);if(isNaN(c.valueOf()))throw{message:"Invalid date/time value"};if(g){c.__edmType="Edm.DateTimeOffset";c.__offset=d}return c},Kc=function(a){return Y(a,false)},mc=function(a){return Y(a,true)},Ib=function(){throw{message:"Edm.Time not supported"};},db={"Edm.Boolean":bd,"Edm.Binary":o,"Edm.DateTime":Kc,"Edm.DateTimeOffset":mc,"Edm.Time":Ib,"Edm.Decimal":o,"Edm.Guid":o,"Edm.String":o,"Edm.Byte":parseInt,"Edm.Double":parseFloat,"Edm.Single":parseFloat,"Edm.Int16":parseInt,"Edm.Int32":parseInt,"Edm.Int64":o,"Edm.SByte":parseInt},i=function(a){return a.toString()},Vc=Ib,Zb={"Edm.Binary":i,"Edm.Boolean":i,"Edm.Byte":i,"Edm.DateTime":J,"Edm.DateTimeOffset":J,"Edm.Decimal":i,"Edm.Double":i,"Edm.Guid":i,"Edm.Int16":i,"Edm.Int32":i,"Edm.Int64":i,"Edm.SByte":i,"Edm.Single":i,"Edm.String":i,"Edm.Time":Vc},N=function(a){return a&&db[a]!==b},V=function(a,b){if(a!==null&&b){var c=db[b];if(c)a=c(a)}return a},X=function(a,b){if(a!==null&&b){if(Mb(a))b=mb(a)?"Edm.DateTimeOffset":"Edm.DateTime";var c=Zb[b];if(c)a=c(a)}return a},nb=function(a,b){if(a.nsURI===f)switch(a.localName){case"feed":return Nc(a,b);case"entry":return zb(a,b)}if(a.nsURI===w&&a.localName==="service")return Yb(a);throw{message:"Invalid AtomPub document: root element can only be feed, entry, or service",element:a};},Nc=function(c,d){var b={results:[],__metadata:{}};b.__metadata.feed_extensions=p(c);a.childElements(c,function(c){switch(c.nsURI){case f:switch(c.localName){case"id":b.__metadata.uri=k(a.innerText(c.domNode),c.baseURI);b.__metadata.uri_extensions=p(c);break;case"title":b.__metadata.title=a.innerText(c.domNode);b.__metadata.title_extensions=p(c);break;case"entry":var h=zb(c,d);b.results.push(h);break;case"link":vc(c,b)}return;case g:if(c.localName==="count"){b.__count=parseInt(a.innerText(c.domNode));return}}var e=r(c);b.__metadata.feed_extensions.push(e)});return b},vc=function(c,b){var a=Cb(c);switch(a.rel){case"next":b.__next=a.href;b.__metadata.next_extensions=a.extensions;break;case"self":b.__metadata.self=a.href;b.__metadata.self_extensions=a.extensions}},Cb=function(c){var b={extensions:[]},d;a.attributes(c,function(a){if(!a.nsURI)switch(a.localName){case"href":b.href=k(a.domNode.nodeValue,c.baseURI);return;case"type":case"rel":b[a.localName]=a.domNode.nodeValue;return}if(z(a.nsURI)){d=q(a);b.extensions.push(d)}});if(!b.href)throw{error:"href attribute missing on link element",element:c};return b},r=function(b){var c={name:b.localName,namespaceURI:b.nsURI,attributes:p(b),children:[]};a.childElements(b,function(b){var a=r(b);c.children.push(a)});if(c.children.length===0){var d=a.innerText(b.domNode);if(d)c.value=d}return c},p=function(c){var b=[];a.attributes(c,function(a){if(z(a.nsURI)){var c=q(a);b.push(c)}});return b},q=function(a){return{name:a.localName,namespaceURI:a.nsURI,value:a.domNode.nodeValue}},hb=function(d,a){if(d.indexOf("/")===-1)return a[d];else{var e=d.split("/"),c,f;for(c=0,f=e.length;c1){var b=a.substr(0,2);return b===b.toUpperCase()?a:a.charAt(0).toLowerCase()+a.substr(1)}return a.charAt(0).toLowerCase()},Cc=function(g,e){if(e==="Documentation")return{isArray:true,propertyName:"documentation"};var c=g.elements;if(!c)return null;var b,f;for(b=0,f=c.length;b0){i=g;e=e.substr(n+1)}var f=a.attribute(b,e,i);if(f){c[Q(e)]=f;var m=1;while(1){var l=e+"_"+m;f=a.attribute(b,l,i);if(!f)break;c[Q(l)]=f;m++}}}}a.childElements(b,function(e){var a=Cc(d,e.localName);if(a)if(a.isArray){var b=c[a.propertyName];if(!b){b=[];c[a.propertyName]=b}b.push(I(e))}else c[a.propertyName]=I(e)});if(d.text)c.text=a.innerText(b);return c},Fc=function(e,c){var d=a.parse(c);return I(d)||b};c.metadataHandler=C(Fc,null,Qc,"1.0");var P="application/json",Wb=function(d,g){var b={collections:[]},a,e;for(a=0,e=d.EntitySets.length;a=200&&c.statusCode<=299)Fb(a.handlerContext).read(c,a.handlerContext);else c={message:"HTTP request failed",response:c}}catch(i){c=i}e.push(c)}g=b.substr(a.position,2);B(b,a)}return e},Gb=function(e,d){var c={},a,b;while(b=B(e,d)){a=b.indexOf(":");if(a!==-1)c[A(b.substring(0,a))]=A(b.substring(a+1))}return c},Oc=function(c,a,d){var b=oc.exec(B(c,a));if(!b)throw{message:"Invalid HTTP response"};return{statusCode:b[1],statusText:b[2],headers:Gb(c,a),body:D(c,a,d)}},B=function(b,a){return D(b,a,"\r\n")},D=function(c,b,d){var e=b.position||0,a=c.length;if(d){a=c.indexOf(d,e);if(a===-1)return null;b.position=a+d.length}else b.position=a;return c.substring(e,a)},Zc=function(g,f){var h=u(g);if(h!==d.batch)throw{message:'Serialization of batches of type "'+h+'" is not supported'};var b=sb("batch_"),e=g.__batchRequests,c="",a,i;for(a=0,i=e.length;a=200&&d<=299)i(f);else h({message:"HTTP request failed",request:c,response:f})};a.open(c.method||"GET",b,true);if(c.headers)for(d in c.headers)a.setRequestHeader(d,c.headers[d]);if(c.timeoutMS){a.timeout=c.timeoutMS;a.ontimeout=function(){if(a){a=null;h({message:"Request timed out"})}}}a.send(c.body)}else{if(!Sc(c))throw{message:"Request is not local and cannot be done through JSONP."};var m=F;F+=1;var n=m.toString();d="handleJSONP_"+n;e[d]=function(a){Hc(d,m);i({body:a,statusCode:200,headers:{"content-type":"application/json"}})};var g=document.createElement("SCRIPT");g.setAttribute("type","text/javascript");var f=this.callbackParameterName+"="+d;if(this.formatQueryString)f+="&"+this.formatQueryString;var j=b.indexOf("?");if(j===-1)b=b+"?"+f;else if(j===b.length-1)b=b+f;else b=b+"&"+f;g.setAttribute("src",b);var l=document.getElementsByTagName("HEAD")[0];l.appendChild(g);l=g=null}return k}};var v=function(f){if(!f)return null;var b=f.split(";"),d={},a,e;for(a=1,e=b.length;a=0},Tc=function(c,h,a,f){if(!a||!a.headers)return false;var g=tb(a),i=fb(a)||"",d=a.body;if(d===b||d===null)return false;if(ub(c,g)){var e=cb(g,i,f?f.metadata:null,c);e.response=a;a.data=h(c,d,e);return a.data&&true}return false},Mc=function(c,f,a,e){if(!a||!a.headers)return false;var d=tb(a),g=fb(a);if(!d||ub(c,d)){var b=cb(d,g,e?e.metadata:null,c);b.request=a;a.body=f(c,a.data,b);if(a.body){lb(a,"DataServiceVersion",b.dataServiceVersion||"1.0");lb(a,"content-type",lc(b.contentType));return true}}return false},C=function(c,b,d,a){return{accept:d,maxDataServiceVersion:a,read:function(a,b){return Tc(this,c,a,b)},write:function(c,a){return Mc(this,b,c,a)}}},Qc="application/xml",ed=/^([^:/?#]+:)?(\/\/[^/?#]*)?([^?#:]+)?(\?[^#]*)?(#.*)?/,Ob="http://",G=Ob+"www.w3.org/",x=Ob+"schemas.microsoft.com/ado/",E=x+"2007/08/dataservices",R=G+"2000/xmlns/",Nb=G+"XML/1998/namespace",Lb=x+"2007/06/edmx",hd=x+"2008/09/edm",fd=x+"2006/04/edm",gd=x+"2007/05/edm",f=G+"2005/Atom",w=G+"2007/app",n=E,g=E+"/metadata",M=E+"/related/",Eb=E+"/scheme",Db=["scheme","authority","path","query","fragment"],Hb=function(e){var b={isAbsolute:false};if(e){var c=ed.exec(e);if(c){var a,d;for(a=0,d=Db.length;a",f=a.parse(g,null),e=c.ownerDocument.importNode(f.domNode,true),b=e.firstChild;while(b){c.appendChild(b);b=b.nextSibling}},appendPreserving:function(a,b){Rb(b)&&a.setAttribute("xml:space","preserve");var c=a.ownerDocument.createTextNode(b);a.appendChild(c)},attributes:function(f,e){var b,c=f.domNode,a,d;for(a=0,d=c.attributes.length;a4)throw{message:"Cannot parse date/time value to given precision."};while(b.length<4)b+="0";b=parseInt(b.substring(1),10)}var j=parseInt(a[4],10),i=parseInt(a[5],10),k=parseInt(a[6],10);if(d!=="Z"){var e=yb(d),h=-e.d;j+=e.h*h;i+=e.m*h}var c=new Date;c.setUTCFullYear(f,parseInt(a[2],10)-1,parseInt(a[3],10));c.setUTCHours(j,i,k,b);if(isNaN(c.valueOf()))throw{message:"Invalid date/time value"};if(g){c.__edmType="Edm.DateTimeOffset";c.__offset=d}return c},Kc=function(a){return Y(a,false)},mc=function(a){return Y(a,true)},Ib=function(){throw{message:"Edm.Time not supported"};},db={"Edm.Boolean":bd,"Edm.Binary":o,"Edm.DateTime":Kc,"Edm.DateTimeOffset":mc,"Edm.Time":Ib,"Edm.Decimal":o,"Edm.Guid":o,"Edm.String":o,"Edm.Byte":parseInt,"Edm.Double":parseFloat,"Edm.Single":parseFloat,"Edm.Int16":parseInt,"Edm.Int32":parseInt,"Edm.Int64":o,"Edm.SByte":parseInt},i=function(a){return a.toString()},Vc=Ib,Zb={"Edm.Binary":i,"Edm.Boolean":i,"Edm.Byte":i,"Edm.DateTime":J,"Edm.DateTimeOffset":J,"Edm.Decimal":i,"Edm.Double":i,"Edm.Guid":i,"Edm.Int16":i,"Edm.Int32":i,"Edm.Int64":i,"Edm.SByte":i,"Edm.Single":i,"Edm.String":i,"Edm.Time":Vc},N=function(a){return a&&db[a]!==b},V=function(a,b){if(a!==null&&b){var c=db[b];if(c)a=c(a)}return a},X=function(a,b){if(a!==null&&b){if(Mb(a))b=mb(a)?"Edm.DateTimeOffset":"Edm.DateTime";var c=Zb[b];if(c)a=c(a)}return a},nb=function(a,b){if(a.nsURI===f)switch(a.localName){case"feed":return Nc(a,b);case"entry":return zb(a,b)}if(a.nsURI===w&&a.localName==="service")return Yb(a);throw{message:"Invalid AtomPub document: root element can only be feed, entry, or service",element:a};},Nc=function(c,d){var b={results:[],__metadata:{}};b.__metadata.feed_extensions=p(c);a.childElements(c,function(c){switch(c.nsURI){case f:switch(c.localName){case"id":b.__metadata.uri=k(a.innerText(c.domNode),c.baseURI);b.__metadata.uri_extensions=p(c);break;case"title":b.__metadata.title=a.innerText(c.domNode);b.__metadata.title_extensions=p(c);break;case"entry":var h=zb(c,d);b.results.push(h);break;case"link":vc(c,b)}return;case g:if(c.localName==="count"){b.__count=parseInt(a.innerText(c.domNode));return}}var e=r(c);b.__metadata.feed_extensions.push(e)});return b},vc=function(c,b){var a=Cb(c);switch(a.rel){case"next":b.__next=a.href;b.__metadata.next_extensions=a.extensions;break;case"self":b.__metadata.self=a.href;b.__metadata.self_extensions=a.extensions}},Cb=function(c){var b={extensions:[]},d;a.attributes(c,function(a){if(!a.nsURI)switch(a.localName){case"href":b.href=k(a.domNode.nodeValue,c.baseURI);return;case"type":case"rel":b[a.localName]=a.domNode.nodeValue;return}if(z(a.nsURI)){d=q(a);b.extensions.push(d)}});if(!b.href)throw{error:"href attribute missing on link element",element:c};return b},r=function(b){var c={name:b.localName,namespaceURI:b.nsURI,attributes:p(b),children:[]};a.childElements(b,function(b){var a=r(b);c.children.push(a)});if(c.children.length===0){var d=a.innerText(b.domNode);if(d)c.value=d}return c},p=function(c){var b=[];a.attributes(c,function(a){if(z(a.nsURI)){var c=q(a);b.push(c)}});return b},q=function(a){return{name:a.localName,namespaceURI:a.nsURI,value:a.domNode.nodeValue}},hb=function(d,a){if(d.indexOf("/")===-1)return a[d];else{var e=d.split("/"),c,f;for(c=0,f=e.length;c1){var b=a.substr(0,2);return b===b.toUpperCase()?a:a.charAt(0).toLowerCase()+a.substr(1)}return a.charAt(0).toLowerCase()},Cc=function(g,e){if(e==="Documentation")return{isArray:true,propertyName:"documentation"};var c=g.elements;if(!c)return null;var b,f;for(b=0,f=c.length;b0){i=g;e=e.substr(n+1)}var f=a.attribute(b,e,i);if(f){c[Q(e)]=f;var m=1;while(1){var l=e+"_"+m;f=a.attribute(b,l,i);if(!f)break;c[Q(l)]=f;m++}}}}a.childElements(b,function(e){var a=Cc(d,e.localName);if(a)if(a.isArray){var b=c[a.propertyName];if(!b){b=[];c[a.propertyName]=b}b.push(I(e))}else c[a.propertyName]=I(e)});if(d.text)c.text=a.innerText(b);return c},Fc=function(e,c){var d=a.parse(c);return I(d)||b};c.metadataHandler=C(Fc,null,Qc,"1.0");var P="application/json",Wb=function(d,g){var b={collections:[]},a,e;for(a=0,e=d.EntitySets.length;a=200&&c.statusCode<=299)Fb(a.handlerContext).read(c,a.handlerContext);else c={message:"HTTP request failed",response:c}}catch(i){c=i}e.push(c)}g=b.substr(a.position,2);B(b,a)}return e},Gb=function(e,d){var c={},a,b;while(b=B(e,d)){a=b.indexOf(":");if(a!==-1)c[A(b.substring(0,a))]=A(b.substring(a+1))}return c},Oc=function(c,a,d){var b=oc.exec(B(c,a));if(!b)throw{message:"Invalid HTTP response"};return{statusCode:b[1],statusText:b[2],headers:Gb(c,a),body:D(c,a,d)}},B=function(b,a){return D(b,a,"\r\n")},D=function(c,b,d){var e=b.position||0,a=c.length;if(d){a=c.indexOf(d,e);if(a===-1)return null;b.position=a+d.length}else b.position=a;return c.substring(e,a)},Zc=function(g,f){var h=u(g);if(h!==d.batch)throw{message:'Serialization of batches of type "'+h+'" is not supported'};var b=sb("batch_"),e=g.__batchRequests,c="",a,i;for(a=0,i=e.length;a