Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
1.9 KiB
Plaintext
1 line
1.9 KiB
Plaintext
{"version":3,"sources":["../../../src/uploads/fetchAPI-multipart/isEligibleRequest.ts"],"sourcesContent":["// eslint-disable-next-line regexp/no-super-linear-backtracking, regexp/no-obscure-range\nconst ACCEPTABLE_CONTENT_TYPE = /multipart\\/['\"()+-_]+(?:; ?['\"()+-_]*)+$/i\nconst UNACCEPTABLE_METHODS = new Set(['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'TRACE'])\n\nconst hasBody = (req: Request): boolean => {\n return Boolean(\n req.headers.get('transfer-encoding') ||\n (req.headers.get('content-length') && req.headers.get('content-length') !== '0'),\n )\n}\n\nconst hasAcceptableMethod = (req: Request): boolean => !UNACCEPTABLE_METHODS.has(req.method)\n\nconst hasAcceptableContentType = (req: Request): boolean => {\n const contType = req.headers.get('content-type')\n return contType!.includes('boundary=') && ACCEPTABLE_CONTENT_TYPE.test(contType!)\n}\n\nexport const isEligibleRequest = (req: Request): boolean => {\n try {\n return hasBody(req) && hasAcceptableMethod(req) && hasAcceptableContentType(req)\n } catch (ignore) {\n return false\n }\n}\n"],"names":["ACCEPTABLE_CONTENT_TYPE","UNACCEPTABLE_METHODS","Set","hasBody","req","Boolean","headers","get","hasAcceptableMethod","has","method","hasAcceptableContentType","contType","includes","test","isEligibleRequest","ignore"],"mappings":"AAAA,wFAAwF;AACxF,MAAMA,0BAA0B;AAChC,MAAMC,uBAAuB,IAAIC,IAAI;IAAC;IAAW;IAAU;IAAO;IAAQ;IAAW;CAAQ;AAE7F,MAAMC,UAAU,CAACC;IACf,OAAOC,QACLD,IAAIE,OAAO,CAACC,GAAG,CAAC,wBACbH,IAAIE,OAAO,CAACC,GAAG,CAAC,qBAAqBH,IAAIE,OAAO,CAACC,GAAG,CAAC,sBAAsB;AAElF;AAEA,MAAMC,sBAAsB,CAACJ,MAA0B,CAACH,qBAAqBQ,GAAG,CAACL,IAAIM,MAAM;AAE3F,MAAMC,2BAA2B,CAACP;IAChC,MAAMQ,WAAWR,IAAIE,OAAO,CAACC,GAAG,CAAC;IACjC,OAAOK,SAAUC,QAAQ,CAAC,gBAAgBb,wBAAwBc,IAAI,CAACF;AACzE;AAEA,OAAO,MAAMG,oBAAoB,CAACX;IAChC,IAAI;QACF,OAAOD,QAAQC,QAAQI,oBAAoBJ,QAAQO,yBAAyBP;IAC9E,EAAE,OAAOY,QAAQ;QACf,OAAO;IACT;AACF,EAAC"} |