@testim/testim-cli 4.164.3 → 4.166.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +1 -1
- package/cli.js.map +2 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -413,7 +413,7 @@ Turbo mode is not allowed for your current plan, please upgrade your plan at htt
|
|
|
413
413
|
\x1B[4m\x1B[36mOur Free grid offers basic service performance.
|
|
414
414
|
If you need faster results, contact us to upgrade your plan and dramatically improve your tests\u2019 run times.\x1B[0m
|
|
415
415
|
`)}function ER(s,e,t){s==="redis"&&xn.start(t,e),s==="mongo"&&Tn.start(e)}async function IR(s,e,t){s==="redis"&&await xn.end(t,e),s==="mongo"&&await Tn.end(e)}async function RR(s){var h,g,y,T,v,b;F("start runner init");let{project:e,lightweightMode:t,useChromeLauncher:r,mode:n,disableSockets:i}=s,o=lR(e,{disableResults:i||Boolean((t==null?void 0:t.disableResults)&&(r||n===K.SELENIUM)),disableRemoteStep:i||Boolean(t==null?void 0:t.disableRemoteStep)});o.catch(()=>{});let{authData:a,companyByProjectId:c,projectById:l,branchName:m,allGrids:d,clientConfig:u}=await ci(s);if(c.disabled)throw new C("The company is disabled.");if(l.disabled)throw new C("The project is disabled.");if(s.printGrids){let w=d.sort((S,A)=>S.type.localeCompare(A.type));console.table(w.reduce((S,A)=>{class D{constructor(R,L){this.Type=R,this.Browsers=L}}let V=Object.entries(A.browsers||{"N/A":""}).map(x=>x.join(":")).join(", ");return S[A.name]=new D(A.type,V),S},{})),process.exit(0)}if(await o,F("after featureFlagsReady and socketConnected"),mR(s,u.editorUrl),dR(s,c),hR(s,l),bR(s,l),uR(s,m),fR(s,d),gR(s,a),await pR(s,l),await yR(s),oR(s,c),(h=s.extensionLocation)!=null&&h.length||(s.extensionLocation=[yg(s)]),O.flags.clearRunnerFileCache.isEnabled())try{await ns(),ld.info("runner file cache cleared")}catch(w){ld.error("failed to clear runner file cache",{err:w})}(g=s.lightweightMode)!=null&&g.disableLabs||await jn.loadLabFeatures(l.id,c.activePlan),((y=s.lightweightMode)==null?void 0:y.type)==="turboMode"&&(O.flags.highSpeedMode.getValue()==="disabled"||s.company.planType==="free")&&delete s.lightweightMode,((T=s.lightweightMode)==null?void 0:T.type)==="turboMode"&&console.log(`
|
|
416
|
-
Turbo mode will ignore step delays. Test artifacts like screenshots and logs will only be saved for failed runs. For more information see our docs: https://help.testim.io/docs/turbo-mode`),ER(s.slotService,e,c.id),cR(e),await TR(s),SR(s);let f=vn();await Q.setOptions(s,f),(b=(v=s.testOptimization)==null?void 0:v.seaLights)!=null&&b.testStage&&s.testOptimization.seaLights.testStage!==sR&&ls(a.uid,"cli-sealights_stage_changed",{testStage:s.testOptimization.seaLights.testStage,projectId:e})}var IT,ST,ET,sR,ld,iR,vR,xT=E(()=>{"use strict";IT=I(require("lodash"));B();cd();$e();cs();fs();us();Al();ge();ct();er();$();Lt();oe();ae();Y();Ip();Uo();wu();de();In();$p();Dn();ST=30*60*1e3,ET=1,sR="Testim Automation",ld=P("runner");iR={desktopWeb:"web",mobileWeb:"web",android:"mobile",ios:"mobile",sfdc:"sfdc"};vR=wR});function AT(s){s.get("/",(e,t)=>{let r=ud();return t.status(200).json({success:!0,isTestimAgent:!0,startMode:r})}),s.get("/version",(e,t)=>{t.status(200).json({node:process.version,app:Ka()})}),s.get("/loginInfo",(e,t)=>{try{let r=JSON.parse(Buffer.from(e.query.info,"base64").toString());Jp({overwriteExisting:!1,projects:r}),t.status(200).end()}catch{t.status(400).end()}})}var CT=E(()=>{"use strict";Qa();pd();Up()});var dd,PT,Us,ac,kT=E(()=>{"use strict";dd=I(require("chalk"));Rs();PT=require("express");$();Y();Us=P("cli-router"),ac=(0,PT.Router)();ac.post("/run",async(s,e)=>{let{code:t,stepId:r,incomingParams:n,context:i,testResultId:o,retryIndex:a,stepResultId:c,timeout:l,fileDataUrl:m}=s.body;if(typeof t!="string"||!r||!n||!i||!o||typeof a!="number"||!c||typeof l!="number"){e.status(400).json({success:!1,code:"invalid-params"});return}let d={stepId:r,testResultId:o,retryIndex:a,stepResultId:c,timeout:l,fileDataUrl:m,nodePackageParams:n.nodePackageParams};try{let u=await Is(t,r,n,i,o,a,c,l,m);u.success||(console.log(dd.default.red(u.result.resultValue)),Us.error("CLI Action Failure",{message:u.result.resultValue,...d})),e.status(200).json({success:!0,data:u})}catch(u){Us.error("failed to run cli code",{err:u,...d}),console.log(dd.default.red("failed to run cli code",u)),e.status(500).json({success:!1,code:"internal-error"})}});ac.post("/install",async(s,e)=>{let{stepId:t,testResultId:r,retryIndex:n,packageData:i,stepResultId:o,timeout:a}=s.body;if(!t||typeof i!="object"||!r||typeof n!="number"||!o||typeof a!="number"){e.status(400).json({success:!1,code:"invalid-params"});return}let c={stepId:t,testResultId:r,retryIndex:n,stepResultId:o,timeout:a,packageData:i};try{let l=await Es(t,r,n,i,o,a);Us.info("installed packages successfully",c),e.status(200).json({success:!0,data:l})}catch(l){if(l instanceof Ct){Us.error("failed to install node packages",{err:l,...c}),e.status(200).json({success:!1,code:"invalid-node-package",message:l.message});return}if(l instanceof ce){Us.error("timeout installing node package",{err:l,...c}),e.status(200).json({success:!1,code:"timeout"});return}Us.error("failed to install node packages",{err:l,...c}),e.status(500).json({success:!1,code:"internal-error"})}})});var OT=E(()=>{"use strict";kT()});var NT={};z(NT,{orchestrateRoutes:()=>xR});function xR(s){let e=(0,LT.default)();e.disable("x-powered-by"),s(e),e.use(md.default.urlencoded({extended:!1,limit:"50mb"})),e.use((0,DT.default)()),e.use(md.default.json({limit:"50mb"}));let r={methods:["GET","PUT","POST","DELETE","OPTIONS"],allowedHeaders:["Content-Type","Authorization"],credentials:!0,maxAge:86400,origin:We||Id?"*":["
|
|
416
|
+
Turbo mode will ignore step delays. Test artifacts like screenshots and logs will only be saved for failed runs. For more information see our docs: https://help.testim.io/docs/turbo-mode`),ER(s.slotService,e,c.id),cR(e),await TR(s),SR(s);let f=vn();await Q.setOptions(s,f),(b=(v=s.testOptimization)==null?void 0:v.seaLights)!=null&&b.testStage&&s.testOptimization.seaLights.testStage!==sR&&ls(a.uid,"cli-sealights_stage_changed",{testStage:s.testOptimization.seaLights.testStage,projectId:e})}var IT,ST,ET,sR,ld,iR,vR,xT=E(()=>{"use strict";IT=I(require("lodash"));B();cd();$e();cs();fs();us();Al();ge();ct();er();$();Lt();oe();ae();Y();Ip();Uo();wu();de();In();$p();Dn();ST=30*60*1e3,ET=1,sR="Testim Automation",ld=P("runner");iR={desktopWeb:"web",mobileWeb:"web",android:"mobile",ios:"mobile",sfdc:"sfdc"};vR=wR});function AT(s){s.get("/",(e,t)=>{let r=ud();return t.status(200).json({success:!0,isTestimAgent:!0,startMode:r})}),s.get("/version",(e,t)=>{t.status(200).json({node:process.version,app:Ka()})}),s.get("/loginInfo",(e,t)=>{try{let r=JSON.parse(Buffer.from(e.query.info,"base64").toString());Jp({overwriteExisting:!1,projects:r}),t.status(200).end()}catch{t.status(400).end()}})}var CT=E(()=>{"use strict";Qa();pd();Up()});var dd,PT,Us,ac,kT=E(()=>{"use strict";dd=I(require("chalk"));Rs();PT=require("express");$();Y();Us=P("cli-router"),ac=(0,PT.Router)();ac.post("/run",async(s,e)=>{let{code:t,stepId:r,incomingParams:n,context:i,testResultId:o,retryIndex:a,stepResultId:c,timeout:l,fileDataUrl:m}=s.body;if(typeof t!="string"||!r||!n||!i||!o||typeof a!="number"||!c||typeof l!="number"){e.status(400).json({success:!1,code:"invalid-params"});return}let d={stepId:r,testResultId:o,retryIndex:a,stepResultId:c,timeout:l,fileDataUrl:m,nodePackageParams:n.nodePackageParams};try{let u=await Is(t,r,n,i,o,a,c,l,m);u.success||(console.log(dd.default.red(u.result.resultValue)),Us.error("CLI Action Failure",{message:u.result.resultValue,...d})),e.status(200).json({success:!0,data:u})}catch(u){Us.error("failed to run cli code",{err:u,...d}),console.log(dd.default.red("failed to run cli code",u)),e.status(500).json({success:!1,code:"internal-error"})}});ac.post("/install",async(s,e)=>{let{stepId:t,testResultId:r,retryIndex:n,packageData:i,stepResultId:o,timeout:a}=s.body;if(!t||typeof i!="object"||!r||typeof n!="number"||!o||typeof a!="number"){e.status(400).json({success:!1,code:"invalid-params"});return}let c={stepId:t,testResultId:r,retryIndex:n,stepResultId:o,timeout:a,packageData:i};try{let l=await Es(t,r,n,i,o,a);Us.info("installed packages successfully",c),e.status(200).json({success:!0,data:l})}catch(l){if(l instanceof Ct){Us.error("failed to install node packages",{err:l,...c}),e.status(200).json({success:!1,code:"invalid-node-package",message:l.message});return}if(l instanceof ce){Us.error("timeout installing node package",{err:l,...c}),e.status(200).json({success:!1,code:"timeout"});return}Us.error("failed to install node packages",{err:l,...c}),e.status(500).json({success:!1,code:"internal-error"})}})});var OT=E(()=>{"use strict";kT()});var NT={};z(NT,{orchestrateRoutes:()=>xR});function xR(s){let e=(0,LT.default)();e.disable("x-powered-by"),s(e),e.use(md.default.urlencoded({extended:!1,limit:"50mb"})),e.use((0,DT.default)()),e.use(md.default.json({limit:"50mb"}));let r={methods:["GET","PUT","POST","DELETE","OPTIONS"],allowedHeaders:["Content-Type","Authorization"],credentials:!0,maxAge:86400,origin:We||Id?"*":["chrome-extension://pebeiooilphfmbohdbhbomomkkoghoia"]};return e.use("*",(0,_T.default)(r)),AT(e),e.use("/cliJs",ac),e.use((n,i)=>{i.status(404).send("Endpoint Not Found")}),e}var _T,LT,md,DT,MT=E(()=>{"use strict";_T=I(require("cors")),LT=I(require("express")),md=I(require("body-parser")),DT=I(require("compression"));CT();OT();oe()});var UT={};z(UT,{init:()=>AR});async function AR({agentPort:s,agentBind:e,project:t,token:r}){let{orchestrateRoutes:n}=await Promise.resolve().then(()=>(MT(),NT));return new Promise((i,o)=>{let a=()=>{};t&&(lf(t,r),a=u=>{u.use((f,h,g)=>{Object.assign(f,{project:t}),g()})});let c=n(a),l=FT.createServer(c);l.listen(s,e),l.on("error",m),l.on("listening",d);function m(u){if(u.syscall!=="listen")return o(u);switch(u.code){case"EACCES":case"EPERM":return o(new C(`Port ${s} requires elevated privileges`));case"EADDRINUSE":return o(new C(`Port ${s} is already in use, is another Testim instance running?`));default:return o(u)}}function d(){let{port:u}=l.address();console.log(`Running on port: ${u}`),CR()}})}async function CR(){await require("prompts")({name:"",type:"text",message:'Type the word "stop" or Press Ctrl + C.',validate:t=>t.toUpperCase().trim()==="STOP"}),console.log("Exiting Testim CLI"),process.exit(0)}var FT,BT=E(()=>{"use strict";FT=I(require("http"));ct();Y()});var qT={};z(qT,{getStartedWithStart:()=>ud,runAgentMode:()=>_R});async function _R(s){var r;let e;if(await Sr(s.playerLocation,s.canary),s.startTestimBrowser){await NR();try{e=await DR(s)}catch(n){throw(r=n==null?void 0:n.message)!=null&&r.includes("user data directory is already in use")?new C('Please close all chrome browsers that were opened with "testim start" and try again'):n}}let t=await Promise.resolve().then(()=>(BT(),UT));return e!=null&&e.webdriverApi&&setTimeout(()=>{setTimeout(()=>(ep(),qe(rb)))},6e3),t.init(s)}function ud(){return GT}function jT(s){try{return process.kill(s,0)}catch{return!1}}async function LR(s,e,t){let r=dr.join(Vt,`chrome-${mn}-process`),n=3e3,i=()=>{Oe.rmSync(r,{recursive:!0}),console.log(`
|
|
417
417
|
|
|
418
418
|
Browser session ended`),process.exit(0)};if(await ye(r)){let f=JSON.parse(Oe.readFileSync(r));if(jT(f.pid)){let h=()=>jT(f.pid)?setTimeout(h,n):i();return h(),{webdriverApi:f}}}let o=await Xi();await ye(Bs)||await Oe.promises.mkdir(Bs,{recursive:!0});let c=[...HT(Bs,e,t,o).desiredCapabilities.chromeOptions.args,...lc.Launcher.defaultFlags().filter(f=>!["--disable-extensions","--disable-component-extensions-with-background-pages"].includes(f))],l={GOOGLE_API_KEY:"AIzaSyCkfPOPZXDKNn8hhgu3JrA62wIgC93d44k",GOOGLE_DEFAULT_CLIENT_ID:"811574891467.apps.googleusercontent.com",GOOGLE_DEFAULT_CLIENT_SECRET:"kdloedMFGdGla2P1zacGjAQh"},m=s.extensionPath?"http://localhost:3000/app/":new URL("?startMode=true",tt||gr).href,d=await lc.launch({chromeFlags:c,startingUrl:m,ignoreDefaultFlags:!0,userDataDir:Bs,chromePath:o,envVars:l}),u={port:d.port,pid:d.pid,cdpUrl:await wr(`localhost:${d.port}`)};return Oe.writeFileSync(r,JSON.stringify(u)),d.process.once("exit",i),d.process.once("close",i),{webdriverApi:u}}async function DR(s){let e=`${mt}/testim-full-master.zip`,t=dr.basename(e),r=dr.join(Vt,t),n=dr.join(Vt,`${t}__unzipped__`),i=!(s.ext||s.extensionPath);if(i&&await ye(r)){let f=await Oe.promises.stat(r);i=Date.now()-kR>f.mtimeMs}if(await Oe.promises.mkdir(Vt,{recursive:!0}),i){let f=(0,WT.default)("Downloading Testim Editor").start();await Je(e,r);try{await ot(r,n)}catch{await Oe.promises.rm(r,{recursive:!0,force:!0}),await Je(e,r);try{await ot(r,n)}catch{throw await Oe.promises.rm(r,{recursive:!0,force:!0}),f.fail("Failed to download Testim Editor"),new Error("Failed to download Testim Editor")}}finally{s.downloadBrowser||await Oe.promises.rm(n,{recursive:!0,force:!0})}f.succeed()}let o=s.extensionPath?null:(await Oe.promises.readFile(s.ext||r)).toString("base64");if(s.downloadBrowser)return await LR(s,o,n);await ln({projectId:s.project},{chromeBinaryLocation:s.chromeBinaryLocations});let a=HT(Bs,o,s.extensionPath,s.chromeBinaryLocations),{WebDriver:c}=(Bn(),qe(Jg)),{SeleniumPerfStats:l}=(ys(),qe(ug)),m=new c;m.seleniumPerfStats=new l;let d=await m.initClient(a);GT=!0;let u=`${s.extensionPath?"http://localhost:3000/app/":tt||gr}?startMode=true`;await m.url(u),Object.assign(m,{initialUrl:u});try{m.cdpUrl=await wr(d.value["goog:chromeOptions"].debuggerAddress)}catch{}return{webdriverApi:m}}function HT(s,e,t,r){let n=e?[e]:[],i=[`--user-data-dir=${s}`,"--log-level=OFF","--silent-debugger-extension-api","--no-first-run"];t&&i.push(`--load-extension=${t}`);try{let o=Oo();o.length&&o.forEach(a=>i.push(`--disable-features=${a}`))}catch{}return{logLevel:PR,desiredCapabilities:{chromeOptions:{args:i,extensions:n,binary:r},browserName:"chrome"},host:"localhost",port:9515}}async function NR(){if(await ye(cc))try{let{webSocketDebuggerUrl:s}=await MR();await FR(s),await Oe.promises.unlink(cc)}catch(s){s&&s.message==="unable to connect to devtools http server"&&await Oe.promises.unlink(cc)}}async function MR(){let s=await Oe.promises.readFile(cc,{encoding:"utf8"}),[e,t]=s.split(`
|
|
419
419
|
`).map(i=>i.trim()),r=Number.parseInt(e,10);if(!Number.isInteger(r)||r<1||r>65535)throw new Error("invalid port number");if(!t.startsWith("/devtools/browser/"))throw new Error("invalid devtools browser url");let n=await wr(`localhost:${r}`,500);if(!n.endsWith(t))throw new Error("invariant webSocketDebuggerUrl miss match");return{port:r,webSocketDebuggerUrl:n}}async function FR(s,e=100){let t=await UR(s,e);return Qt(r=>{t.send(JSON.stringify({id:0,method:"Browser.close"}),r)})}async function UR(s,e=100){let t=ja({timeout:e}),r=new VT.default(s,t),n=Qt(o=>{r.once("open",o)}).then(()=>{r.removeAllListeners()}),i=Qt(o=>{r.once("error",o)}).catch(()=>{r.close(),r.removeAllListeners()});return Promise.race([n,i]).then(()=>r)}var $T,WT,VT,Oe,dr,lc,PR,kR,Bs,OR,cc,GT,pd=E(()=>{"use strict";$T=I(require("ms")),WT=I(require("ora")),VT=I(require("ws")),Oe=I(require("node:fs")),dr=I(require("node:path")),lc=I(require("chrome-launcher"));oe();pn();Y();fl();B();Lo();$a();PR=wi?"verbose":"silent",kR=(0,$T.default)("1h"),Bs=dr.join(Vt,"profile"),OR="DevToolsActivePort",cc=dr.join(Bs,OR);GT=!1});var $N=require("source-map-support/register");var yi=I(require("os")),$s=I(require("url")),Ws=I(require("http")),dc=I(require("https")),pi=I(require("form-data")),di=class{constructor(){this.onloadstart=null;this.onprogress=null;this.onabort=null;this.onerror=null;this.onload=null;this.ontimeout=null;this.onloadend=null;this._listeners={}}addEventListener(e,t){e=e.toLowerCase(),this._listeners[e]||=[],this._listeners[e].push(t)}removeEventListener(e,t){let r;e=e.toLowerCase(),this._listeners[e]&&(r=this._listeners[e].indexOf(t),r!==-1&&this._listeners[e].splice(r,1))}dispatchEvent(e){var n;e.currentTarget=this,e.target=this;let t=e.type,r=this._listeners[t]||[];for(let i of r)i==null||i.call(this,e);(n=this[`on${t}`])==null||n.call(this,e)}},mi=class extends di{constructor(t){super();this._request=t;this._contentType=null;this._body=null}_reset(){this._contentType=null,this._body=null}_setData(t){if(t!=null)if(typeof t=="string")t.length!==0&&(this._contentType="text/plain;charset=UTF-8"),this._body=Buffer.from(t,"utf8");else if(Buffer.isBuffer(t))this._body=t;else if(t instanceof ArrayBuffer){let r=Buffer.alloc(t.byteLength),n=new Uint8Array(t);for(let i=0;i<t.byteLength;i++)r[i]=n[i];this._body=r}else if("buffer"in t&&t.buffer instanceof ArrayBuffer){let r=Buffer.alloc(t.byteLength),n=t.byteOffset,i=new Uint8Array(t.buffer);for(let o=0;o<t.byteLength;o++)r[o]=i[o+n];this._body=r}else if(typeof t=="object"&&t instanceof pi.default)this._body=null;else throw new Error(`Unsupported send() data ${t}`)}_finalizeHeaders(t,r){this._contentType&&!("content-type"in r)&&(t["Content-Type"]=this._contentType),this._body&&(t["Content-Length"]=this._body.length.toString())}_startUpload(t){this._body&&t.write(this._body),t.end()}},js=class{constructor(e){this.type=e;this.target=null;this.currentTarget=null;this.lengthComputable=!1;this.loaded=0;this.total=0;this.bubbles=!1;this.cancelable=!1}},fi=class extends Error{},gi=class extends Error{},hi=class extends Error{},mr=class extends Error{},xe=class extends di{constructor(t){super();this.UNSENT=0;this.OPENED=1;this.HEADERS_RECEIVED=2;this.LOADING=3;this.DONE=4;this.nodejsHttpAgent=Ws.globalAgent;this.nodejsHttpsAgent=dc.globalAgent;this.nodejsBaseUrl=null;this._restrictedMethods={CONNECT:!0,TRACE:!0,TRACK:!0};this._restrictedHeaders={"accept-charset":!0,"accept-encoding":!0,"access-control-request-headers":!0,"access-control-request-method":!0,connection:!0,"content-length":!0,cookie:!0,cookie2:!0,date:!0,dnt:!0,expect:!0,host:!0,"keep-alive":!0,origin:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,via:!0};this._privateHeaders={"set-cookie":!1,"set-cookie2":!1};this._userAgent=`Mozilla/5.0 (${yi.type()} ${yi.arch()}) node.js/${process.versions.node} v8/${process.versions.v8}`;this.onreadystatechange=null;this.readyState=xe.UNSENT;this.response=null;this.responseText="";this.responseType="";this.status=0;this.statusText="";this.timeout=0;this.upload=new mi(this);this._method=null;this._url=null;this._sync=!1;this._headers=null;this._loweredHeaders=null;this._mimeOverride=null;this._request=null;this._response=null;this._responseParts=null;this._responseHeaders=null;this._aborting=null;this._error=null;this._loadedBytes=0;this._totalBytes=0;this._lengthComputable=!1;this._anonymous=t==null?void 0:t.anon}static nodejsSet(t){xe.prototype.nodejsSet(t)}nodejsSet(t){if("httpAgent"in t&&(this.nodejsHttpAgent=t.httpAgent),"httpsAgent"in t&&(this.nodejsHttpsAgent=t.httpsAgent),"baseUrl"in t){let r=t.baseUrl;if(r!==null&&!$s.parse(r,!1,!0).protocol)throw new fi("baseUrl must be an absolute URL");this.nodejsBaseUrl=r}}open(t,r,n){if(t=t.toUpperCase(),t in this._restrictedMethods)throw new hi(`HTTP method ${t} is not allowed in XHR`);let i=this._parseUrl(r);n===void 0&&(n=!0),this._method=t,this._url=i,this._sync=!n,this._headers={},this._loweredHeaders={},this._mimeOverride=null,this._setReadyState(xe.OPENED),this._request=null,this._response=null,this.status=0,this.statusText="",this._responseParts=[],this._responseHeaders=null,this._loadedBytes=0,this._totalBytes=0,this._lengthComputable=!1}setRequestHeader(t,r){if(this.readyState!==xe.OPENED)throw new mr("XHR readyState must be OPENED");let n=t.toLowerCase();this._restrictedHeaders[n]||n.startsWith("sec-")||n.startsWith("proxy-")||(r=r.toString(),n in this._loweredHeaders?(t=this._loweredHeaders[n],this._headers[t]=`${this._headers[t]}, ${r}`):(this._loweredHeaders[n]=t,this._headers[t]=r))}send(t){if(this.readyState!==xe.OPENED)throw new mr("XHR readyState must be OPENED");if(this._request)throw new mr("send() already called");switch(this._url.protocol){case"file:":this._sendFile();break;case"http:":case"https:":this._sendHttp(t);break;default:throw new gi(`XHR request to ${this._url.href} failed: unsupported protocol '${this._url.protocol}'. Please use supported protocols like HTTP, HTTPS, or file.`)}}abort(){this._request&&(this._request.abort(),this._setError(),this._dispatchProgress("abort"),this._dispatchProgress("loadend"))}getResponseHeader(t){var n;let r=t.toLowerCase();return((n=this._responseHeaders)==null?void 0:n[r])||null}getAllResponseHeaders(){return this._responseHeaders?Object.entries(this._responseHeaders).map(([t,r])=>`${t}: ${r}`).join(`\r
|