@nocobase/plugin-file-manager 2.0.0-alpha.9 → 2.0.0-beta.2
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/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/models/DisplayPreviewFieldModel.d.ts +1 -0
- package/dist/client/models/UploadActionModel.d.ts +3 -1
- package/dist/client/schemas/storageTypes/ali-oss.d.ts +12 -0
- package/dist/client/schemas/storageTypes/common.d.ts +12 -0
- package/dist/client/schemas/storageTypes/index.d.ts +48 -0
- package/dist/client/schemas/storageTypes/local.d.ts +12 -0
- package/dist/client/schemas/storageTypes/s3.d.ts +12 -0
- package/dist/client/schemas/storageTypes/tx-cos.d.ts +12 -0
- package/dist/client/templates/file.d.ts +4 -0
- package/dist/common/collections/storages.d.ts +11 -0
- package/dist/common/collections/storages.js +6 -0
- package/dist/externalVersion.js +8 -8
- package/dist/locale/de-DE.json +42 -29
- package/dist/locale/en-US.json +43 -30
- package/dist/locale/es-ES.json +54 -0
- package/dist/locale/fr-FR.json +45 -12
- package/dist/locale/hu-HU.json +48 -0
- package/dist/locale/id-ID.json +48 -0
- package/dist/locale/it-IT.json +43 -28
- package/dist/locale/ja-JP.json +43 -30
- package/dist/locale/ko-KR.json +46 -24
- package/dist/locale/nl-NL.json +53 -39
- package/dist/locale/pt-BR.json +54 -0
- package/dist/locale/ru-RU.json +47 -11
- package/dist/locale/tr-TR.json +47 -10
- package/dist/locale/uk-UA.json +54 -0
- package/dist/locale/vi-VN.json +48 -0
- package/dist/locale/zh-CN.json +41 -31
- package/dist/locale/zh-TW.json +54 -0
- package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
- package/dist/node_modules/@aws-sdk/lib-storage/LICENSE +201 -0
- package/dist/node_modules/{multer-s3 → @aws-sdk/lib-storage/dist-cjs}/index.js +574 -6229
- package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/runtimeConfig.browser.js +8 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/runtimeConfig.js +10 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/runtimeConfig.native.js +8 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/runtimeConfig.shared.js +6 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/Upload.js +304 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/bytelength.js +27 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunker.js +24 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunks/getChunkStream.js +24 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunks/getChunkUint8Array.js +19 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunks/getDataReadable.js +11 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunks/getDataReadableStream.js +24 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/index.js +2 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/runtimeConfig.browser.js +5 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/runtimeConfig.js +7 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/runtimeConfig.native.js +5 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/runtimeConfig.shared.js +3 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/types.js +1 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/Upload.d.ts +59 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/bytelength.d.ts +1 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunker.d.ts +3 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunks/getChunkStream.d.ts +2 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunks/getChunkUint8Array.d.ts +2 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunks/getDataReadable.d.ts +3 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunks/getDataReadableStream.d.ts +1 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/index.d.ts +2 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/runtimeConfig.browser.d.ts +7 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/runtimeConfig.d.ts +8 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/runtimeConfig.native.d.ts +7 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/runtimeConfig.shared.d.ts +6 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/Upload.d.ts +43 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/bytelength.d.ts +1 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunker.d.ts +6 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunks/getChunkStream.d.ts +6 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunks/getChunkUint8Array.d.ts +5 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunks/getDataReadable.d.ts +4 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunks/getDataReadableStream.d.ts +3 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/index.d.ts +2 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/runtimeConfig.browser.d.ts +4 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/runtimeConfig.d.ts +4 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/runtimeConfig.native.d.ts +4 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/runtimeConfig.shared.d.ts +3 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/types.d.ts +22 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/types.d.ts +51 -0
- package/dist/node_modules/@aws-sdk/lib-storage/package.json +1 -0
- package/dist/node_modules/{multer-s3 → ali-oss}/LICENSE +1 -2
- package/dist/node_modules/ali-oss/dist/aliyun-oss-sdk.js +44018 -0
- package/dist/node_modules/ali-oss/dist/aliyun-oss-sdk.min.js +4 -0
- package/dist/node_modules/ali-oss/lib/browser/bucket.js +296 -0
- package/dist/node_modules/ali-oss/lib/browser/client.js +452 -0
- package/dist/node_modules/ali-oss/lib/browser/managed-upload.js +360 -0
- package/dist/node_modules/ali-oss/lib/browser/object.js +385 -0
- package/dist/node_modules/ali-oss/lib/browser/version.js +1 -0
- package/dist/node_modules/ali-oss/lib/browser.js +6 -0
- package/dist/node_modules/ali-oss/lib/bucket.js +337 -0
- package/dist/node_modules/{multer-aliyun-oss/index.js → ali-oss/lib/client.js} +2 -2
- package/dist/node_modules/ali-oss/lib/cluster.js +228 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/abortBucketWorm.d.ts +4 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/abortBucketWorm.js +14 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/abortBucketWorm.ts +12 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/completeBucketWorm.d.ts +4 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/completeBucketWorm.js +14 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/completeBucketWorm.ts +12 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketEncryption.js +20 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketInventory.d.ts +10 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketInventory.js +22 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketInventory.ts +21 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketLifecycle.js +13 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketPolicy.js +21 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketTags.js +21 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketWebsite.js +13 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/extendBucketWorm.d.ts +4 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/extendBucketWorm.js +23 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/extendBucketWorm.ts +21 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketEncryption.js +21 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketInventory.d.ts +11 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketInventory.js +25 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketInventory.ts +24 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketLifecycle.js +33 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketPolicy.js +28 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketRequestPayment.js +25 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketStat.d.ts +23 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketStat.js +17 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketStat.ts +34 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketTags.js +23 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketVersioning.js +22 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketWebsite.js +28 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketWorm.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketWorm.js +20 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketWorm.ts +22 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/index.js +34 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/initiateBucketWorm.d.ts +5 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/initiateBucketWorm.js +24 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/initiateBucketWorm.ts +23 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/listBucketInventory.d.ts +13 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/listBucketInventory.js +29 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/listBucketInventory.ts +32 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucket.js +31 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketEncryption.js +36 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketInventory.d.ts +36 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketInventory.js +58 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketInventory.ts +84 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketLifecycle.js +127 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketPolicy.js +27 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketRequestPayment.js +40 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketTags.js +39 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketVersioning.js +35 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketWebsite.js +50 -0
- package/dist/node_modules/ali-oss/lib/common/callback.js +27 -0
- package/dist/node_modules/ali-oss/lib/common/client/getReqUrl.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/client/getReqUrl.js +52 -0
- package/dist/node_modules/ali-oss/lib/common/client/getReqUrl.ts +51 -0
- package/dist/node_modules/ali-oss/lib/common/client/initOptions.js +72 -0
- package/dist/node_modules/ali-oss/lib/common/image/index.js +5 -0
- package/dist/node_modules/ali-oss/lib/common/image/processObjectSave.js +45 -0
- package/dist/node_modules/ali-oss/lib/common/multipart-copy.js +240 -0
- package/dist/node_modules/ali-oss/lib/common/multipart.js +271 -0
- package/dist/node_modules/ali-oss/lib/common/object/asyncSignatureUrl.js +57 -0
- package/dist/node_modules/ali-oss/lib/common/object/calculatePostSignature.js +35 -0
- package/dist/node_modules/ali-oss/lib/common/object/copyObject.js +74 -0
- package/dist/node_modules/ali-oss/lib/common/object/delete.js +22 -0
- package/dist/node_modules/ali-oss/lib/common/object/deleteMulti.js +57 -0
- package/dist/node_modules/ali-oss/lib/common/object/deleteObjectTagging.js +22 -0
- package/dist/node_modules/ali-oss/lib/common/object/generateObjectUrl.js +28 -0
- package/dist/node_modules/ali-oss/lib/common/object/get.js +64 -0
- package/dist/node_modules/ali-oss/lib/common/object/getACL.js +30 -0
- package/dist/node_modules/ali-oss/lib/common/object/getAsyncFetch.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/object/getAsyncFetch.js +26 -0
- package/dist/node_modules/ali-oss/lib/common/object/getAsyncFetch.ts +25 -0
- package/dist/node_modules/ali-oss/lib/common/object/getBucketVersions.js +98 -0
- package/dist/node_modules/ali-oss/lib/common/object/getObjectMeta.js +23 -0
- package/dist/node_modules/ali-oss/lib/common/object/getObjectTagging.js +34 -0
- package/dist/node_modules/ali-oss/lib/common/object/getObjectUrl.js +21 -0
- package/dist/node_modules/ali-oss/lib/common/object/getSymlink.js +23 -0
- package/dist/node_modules/ali-oss/lib/common/object/head.js +40 -0
- package/dist/node_modules/ali-oss/lib/common/object/index.js +26 -0
- package/dist/node_modules/ali-oss/lib/common/object/postAsyncFetch.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/object/postAsyncFetch.js +44 -0
- package/dist/node_modules/ali-oss/lib/common/object/postAsyncFetch.ts +46 -0
- package/dist/node_modules/ali-oss/lib/common/object/putACL.js +27 -0
- package/dist/node_modules/ali-oss/lib/common/object/putObjectTagging.js +43 -0
- package/dist/node_modules/ali-oss/lib/common/object/putSymlink.js +33 -0
- package/dist/node_modules/ali-oss/lib/common/object/signatureUrl.js +52 -0
- package/dist/node_modules/ali-oss/lib/common/object/signatureUrlV4.js +70 -0
- package/dist/node_modules/ali-oss/lib/common/parallel.js +177 -0
- package/dist/node_modules/ali-oss/lib/common/signUtils.js +355 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketName.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketName.js +9 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketName.ts +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketNameTest.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketNameTest.js +14 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketNameTest.ts +12 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketTag.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketTag.js +49 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketTag.ts +52 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkConfigValid.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkConfigValid.js +30 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkConfigValid.ts +27 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkEnv.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkEnv.js +9 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkEnv.ts +5 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkObjectTag.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkObjectTag.js +50 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkObjectTag.ts +53 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkUserAgent.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkUserAgent.js +7 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkUserAgent.ts +4 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkValid.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkValid.js +14 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkValid.ts +9 -0
- package/dist/node_modules/ali-oss/lib/common/utils/createRequest.d.ts +8 -0
- package/dist/node_modules/ali-oss/lib/common/utils/createRequest.js +139 -0
- package/dist/node_modules/ali-oss/lib/common/utils/createRequest.ts +169 -0
- package/dist/node_modules/ali-oss/lib/common/utils/dataFix.d.ts +12 -0
- package/dist/node_modules/ali-oss/lib/common/utils/dataFix.js +63 -0
- package/dist/node_modules/ali-oss/lib/common/utils/dataFix.ts +78 -0
- package/dist/node_modules/ali-oss/lib/common/utils/deepCopy.d.ts +2 -0
- package/dist/node_modules/ali-oss/lib/common/utils/deepCopy.js +41 -0
- package/dist/node_modules/ali-oss/lib/common/utils/deepCopy.ts +47 -0
- package/dist/node_modules/ali-oss/lib/common/utils/encodeString.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/encodeString.js +12 -0
- package/dist/node_modules/ali-oss/lib/common/utils/encodeString.ts +7 -0
- package/dist/node_modules/ali-oss/lib/common/utils/encoder.d.ts +2 -0
- package/dist/node_modules/ali-oss/lib/common/utils/encoder.js +9 -0
- package/dist/node_modules/ali-oss/lib/common/utils/encoder.ts +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatInventoryConfig.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatInventoryConfig.js +45 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatInventoryConfig.ts +41 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatObjKey.d.ts +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatObjKey.js +34 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatObjKey.ts +35 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatTag.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatTag.js +22 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatTag.ts +20 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getStandardRegion.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getStandardRegion.js +7 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getStandardRegion.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getStrBytesCount.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getStrBytesCount.js +17 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getStrBytesCount.ts +12 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getUserAgent.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getUserAgent.js +18 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getUserAgent.ts +14 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isArray.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isArray.js +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isArray.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isBlob.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isBlob.js +7 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isBlob.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isBuffer.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isBuffer.js +7 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isBuffer.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isDingTalk.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isDingTalk.js +10 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isDingTalk.ts +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isFile.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isFile.js +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isFile.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isFunction.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isFunction.js +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isFunction.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isIP.d.ts +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isIP.js +14 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isIP.ts +12 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isObject.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isObject.js +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isObject.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/lowercaseKeyHeader.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/lowercaseKeyHeader.js +14 -0
- package/dist/node_modules/ali-oss/lib/common/utils/lowercaseKeyHeader.ts +11 -0
- package/dist/node_modules/ali-oss/lib/common/utils/obj2xml.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/obj2xml.js +43 -0
- package/dist/node_modules/ali-oss/lib/common/utils/obj2xml.ts +37 -0
- package/dist/node_modules/ali-oss/lib/common/utils/omit.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/omit.js +11 -0
- package/dist/node_modules/ali-oss/lib/common/utils/omit.ts +9 -0
- package/dist/node_modules/ali-oss/lib/common/utils/policy2Str.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/policy2Str.js +21 -0
- package/dist/node_modules/ali-oss/lib/common/utils/policy2Str.ts +15 -0
- package/dist/node_modules/ali-oss/lib/common/utils/retry.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/retry.js +30 -0
- package/dist/node_modules/ali-oss/lib/common/utils/retry.ts +26 -0
- package/dist/node_modules/ali-oss/lib/common/utils/setRegion.d.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/setRegion.js +20 -0
- package/dist/node_modules/ali-oss/lib/common/utils/setRegion.ts +15 -0
- package/dist/node_modules/ali-oss/lib/common/utils/setSTSToken.d.ts +2 -0
- package/dist/node_modules/ali-oss/lib/common/utils/setSTSToken.js +36 -0
- package/dist/node_modules/ali-oss/lib/common/utils/setSTSToken.ts +32 -0
- package/dist/node_modules/ali-oss/lib/global.d.ts +6 -0
- package/dist/node_modules/ali-oss/lib/image.js +146 -0
- package/dist/node_modules/ali-oss/lib/managed-upload.js +380 -0
- package/dist/node_modules/ali-oss/lib/object.js +420 -0
- package/dist/node_modules/ali-oss/lib/rtmp.js +295 -0
- package/dist/node_modules/ali-oss/lib/setConfig.d.ts +3 -0
- package/dist/node_modules/ali-oss/lib/setConfig.js +42 -0
- package/dist/node_modules/ali-oss/lib/setConfig.ts +52 -0
- package/dist/node_modules/ali-oss/lib/sts.js +156 -0
- package/dist/node_modules/ali-oss/lib/types/experimental.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/types/experimental.js +2 -0
- package/dist/node_modules/ali-oss/lib/types/experimental.ts +1 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.editorconfig +17 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/.name +1 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/bowser.iml +8 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/encodings.xml +6 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/jsLibraryMappings.xml +8 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/markdown-exported-files.xml +8 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/markdown-navigator/profiles_settings.xml +3 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/markdown-navigator.xml +67 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/misc.xml +6 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/modules.xml +8 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/vcs.xml +6 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/watcherTasks.xml +4 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/workspace.xml +696 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.travis.yml +8 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/bower.json +33 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/bowser.js +644 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/bowser.min.js +6 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/package.json +38 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/src/bowser.js +644 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/test/test.js +151 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/typings.d.ts +115 -0
- package/dist/node_modules/ali-oss/node_modules/dateformat/.vs/ProjectSettings.json +3 -0
- package/dist/node_modules/ali-oss/node_modules/dateformat/.vs/config/applicationhost.config +1031 -0
- package/dist/node_modules/ali-oss/node_modules/dateformat/.vs/node-dateformat/v15/.suo +0 -0
- package/dist/node_modules/ali-oss/node_modules/dateformat/.vs/slnx.sqlite +0 -0
- package/dist/node_modules/ali-oss/node_modules/dateformat/lib/dateformat.js +226 -0
- package/dist/node_modules/ali-oss/node_modules/dateformat/package.json +30 -0
- package/dist/node_modules/ali-oss/node_modules/mime/Mime.js +97 -0
- package/dist/node_modules/ali-oss/node_modules/mime/cli.js +46 -0
- package/dist/node_modules/ali-oss/node_modules/mime/index.js +4 -0
- package/dist/node_modules/ali-oss/node_modules/mime/lite.js +4 -0
- package/dist/node_modules/ali-oss/node_modules/mime/package.json +52 -0
- package/dist/node_modules/ali-oss/node_modules/mime/types/other.js +1 -0
- package/dist/node_modules/ali-oss/node_modules/mime/types/standard.js +1 -0
- package/dist/node_modules/ali-oss/package.json +1 -0
- package/dist/node_modules/ali-oss/shims/crypto/crypto.js +98 -0
- package/dist/node_modules/ali-oss/shims/crypto/helpers.js +36 -0
- package/dist/node_modules/ali-oss/shims/crypto/md5.js +152 -0
- package/dist/node_modules/ali-oss/shims/crypto/sha.js +91 -0
- package/dist/node_modules/ali-oss/shims/crypto/sha256.js +163 -0
- package/dist/node_modules/ali-oss/shims/debug.js +3 -0
- package/dist/node_modules/ali-oss/shims/is-type-of.js +18 -0
- package/dist/node_modules/ali-oss/shims/process.js +35 -0
- package/dist/node_modules/ali-oss/shims/stream-http/index.js +82 -0
- package/dist/node_modules/ali-oss/shims/stream-http/lib/capability.js +72 -0
- package/dist/node_modules/ali-oss/shims/stream-http/lib/request.js +320 -0
- package/dist/node_modules/ali-oss/shims/stream-http/lib/response.js +217 -0
- package/dist/node_modules/ali-oss/shims/url/index.js +696 -0
- package/dist/node_modules/ali-oss/shims/url/util.js +16 -0
- package/dist/node_modules/ali-oss/shims/utility.js +25 -0
- package/dist/node_modules/ali-oss/shims/xhr.js +798 -0
- package/dist/node_modules/mime-match/package.json +1 -1
- package/dist/node_modules/mime-types/package.json +1 -1
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/multer-cos/package.json +1 -1
- package/dist/node_modules/url-join/package.json +1 -1
- package/dist/server/actions/storages.js +4 -6
- package/dist/server/server.js +1 -0
- package/dist/server/storages/ali-oss.d.ts +15 -1
- package/dist/server/storages/ali-oss.js +66 -2
- package/dist/server/storages/index.d.ts +1 -0
- package/dist/server/storages/local.js +1 -1
- package/dist/server/storages/s3.d.ts +10 -3
- package/dist/server/storages/s3.js +121 -29
- package/dist/server/storages/tx-cos.js +1 -1
- package/dist/server/utils.d.ts +1 -0
- package/dist/server/utils.js +43 -0
- package/package.json +7 -3
- package/dist/node_modules/multer-aliyun-oss/package.json +0 -1
- package/dist/node_modules/multer-s3/.gitattributes +0 -1
- package/dist/node_modules/multer-s3/.travis.yml +0 -6
- package/dist/node_modules/multer-s3/package.json +0 -1
- package/dist/node_modules/multer-s3/test/basic.js +0 -293
- package/dist/node_modules/multer-s3/test/files/a.txt +0 -1
- package/dist/node_modules/multer-s3/test/files/test.svg +0 -3
- package/dist/node_modules/multer-s3/test/files/test2.svg +0 -9
- package/dist/node_modules/multer-s3/test/util/mock-s3.js +0 -17
|
@@ -0,0 +1,798 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const util = require('util');
|
|
3
|
+
const urlutil = require('url');
|
|
4
|
+
const http = require('http');
|
|
5
|
+
const https = require('https');
|
|
6
|
+
const debug = require('debug')('urllib');
|
|
7
|
+
const ms = require('humanize-ms');
|
|
8
|
+
let REQUEST_ID = 0;
|
|
9
|
+
const MAX_VALUE = Math.pow(2, 31) - 10;
|
|
10
|
+
const PROTO_RE = /^https?:\/\//i;
|
|
11
|
+
|
|
12
|
+
function getAgent(agent, defaultAgent) {
|
|
13
|
+
return agent === undefined ? defaultAgent : agent;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function parseContentType(str) {
|
|
17
|
+
if (!str) {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return str.split(';')[0].trim().toLowerCase();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function makeCallback(resolve, reject) {
|
|
25
|
+
return function (err, data, res) {
|
|
26
|
+
if (err) {
|
|
27
|
+
return reject(err);
|
|
28
|
+
}
|
|
29
|
+
resolve({
|
|
30
|
+
data: data,
|
|
31
|
+
status: res.statusCode,
|
|
32
|
+
headers: res.headers,
|
|
33
|
+
res: res
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// exports.TIMEOUT = ms('5s');
|
|
39
|
+
exports.TIMEOUTS = [ms('300s'), ms('300s')];
|
|
40
|
+
|
|
41
|
+
const TEXT_DATA_TYPES = ['json', 'text'];
|
|
42
|
+
|
|
43
|
+
exports.request = function request(url, args, callback) {
|
|
44
|
+
// request(url, callback)
|
|
45
|
+
if (arguments.length === 2 && typeof args === 'function') {
|
|
46
|
+
callback = args;
|
|
47
|
+
args = null;
|
|
48
|
+
}
|
|
49
|
+
if (typeof callback === 'function') {
|
|
50
|
+
return exports.requestWithCallback(url, args, callback);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return new Promise(function (resolve, reject) {
|
|
54
|
+
exports.requestWithCallback(url, args, makeCallback(resolve, reject));
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
exports.requestWithCallback = function requestWithCallback(url, args, callback) {
|
|
59
|
+
if (!url || (typeof url !== 'string' && typeof url !== 'object')) {
|
|
60
|
+
const msg = util.format('expect request url to be a string or a http request options, but got' + ' %j', url);
|
|
61
|
+
throw new Error(msg);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (arguments.length === 2 && typeof args === 'function') {
|
|
65
|
+
callback = args;
|
|
66
|
+
args = null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
args = args || {};
|
|
70
|
+
if (REQUEST_ID >= MAX_VALUE) {
|
|
71
|
+
REQUEST_ID = 0;
|
|
72
|
+
}
|
|
73
|
+
const reqId = ++REQUEST_ID;
|
|
74
|
+
|
|
75
|
+
args.requestUrls = args.requestUrls || [];
|
|
76
|
+
|
|
77
|
+
const reqMeta = {
|
|
78
|
+
requestId: reqId,
|
|
79
|
+
url: url,
|
|
80
|
+
args: args,
|
|
81
|
+
ctx: args.ctx
|
|
82
|
+
};
|
|
83
|
+
if (args.emitter) {
|
|
84
|
+
args.emitter.emit('request', reqMeta);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
args.timeout = args.timeout || exports.TIMEOUTS;
|
|
88
|
+
args.maxRedirects = args.maxRedirects || 10;
|
|
89
|
+
args.streaming = args.streaming || args.customResponse;
|
|
90
|
+
const requestStartTime = Date.now();
|
|
91
|
+
let parsedUrl;
|
|
92
|
+
|
|
93
|
+
if (typeof url === 'string') {
|
|
94
|
+
if (!PROTO_RE.test(url)) {
|
|
95
|
+
// Support `request('www.server.com')`
|
|
96
|
+
url = 'https://' + url;
|
|
97
|
+
}
|
|
98
|
+
parsedUrl = urlutil.parse(url);
|
|
99
|
+
} else {
|
|
100
|
+
parsedUrl = url;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const method = (args.type || args.method || parsedUrl.method || 'GET').toUpperCase();
|
|
104
|
+
let port = parsedUrl.port || 80;
|
|
105
|
+
let httplib = http;
|
|
106
|
+
let agent = getAgent(args.agent, exports.agent);
|
|
107
|
+
const fixJSONCtlChars = args.fixJSONCtlChars;
|
|
108
|
+
|
|
109
|
+
if (parsedUrl.protocol === 'https:') {
|
|
110
|
+
httplib = https;
|
|
111
|
+
agent = getAgent(args.httpsAgent, exports.httpsAgent);
|
|
112
|
+
|
|
113
|
+
if (!parsedUrl.port) {
|
|
114
|
+
port = 443;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// request through proxy tunnel
|
|
119
|
+
// var proxyTunnelAgent = detectProxyAgent(parsedUrl, args);
|
|
120
|
+
// if (proxyTunnelAgent) {
|
|
121
|
+
// agent = proxyTunnelAgent;
|
|
122
|
+
// }
|
|
123
|
+
|
|
124
|
+
const options = {
|
|
125
|
+
host: parsedUrl.hostname || parsedUrl.host || 'localhost',
|
|
126
|
+
path: parsedUrl.path || '/',
|
|
127
|
+
method: method,
|
|
128
|
+
port: port,
|
|
129
|
+
agent: agent,
|
|
130
|
+
headers: args.headers || {},
|
|
131
|
+
// default is dns.lookup
|
|
132
|
+
// https://github.com/nodejs/node/blob/master/lib/net.js#L986
|
|
133
|
+
// custom dnslookup require node >= 4.0.0
|
|
134
|
+
// https://github.com/nodejs/node/blob/archived-io.js-v0.12/lib/net.js#L952
|
|
135
|
+
lookup: args.lookup
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
if (Array.isArray(args.timeout)) {
|
|
139
|
+
options.requestTimeout = args.timeout[args.timeout.length - 1];
|
|
140
|
+
} else if (typeof args.timeout !== 'undefined') {
|
|
141
|
+
options.requestTimeout = args.timeout;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// const sslNames = [
|
|
145
|
+
// 'pfx',
|
|
146
|
+
// 'key',
|
|
147
|
+
// 'passphrase',
|
|
148
|
+
// 'cert',
|
|
149
|
+
// 'ca',
|
|
150
|
+
// 'ciphers',
|
|
151
|
+
// 'rejectUnauthorized',
|
|
152
|
+
// 'secureProtocol',
|
|
153
|
+
// 'secureOptions',
|
|
154
|
+
// ];
|
|
155
|
+
// for (let i = 0; i < sslNames.length; i++) {
|
|
156
|
+
// const name = sslNames[i];
|
|
157
|
+
// if (args.hasOwnProperty(name)) {
|
|
158
|
+
// options[name] = args[name];
|
|
159
|
+
// }
|
|
160
|
+
// }
|
|
161
|
+
|
|
162
|
+
// don't check ssl
|
|
163
|
+
// if (options.rejectUnauthorized === false && !options.hasOwnProperty('secureOptions')) {
|
|
164
|
+
// options.secureOptions = require('constants').SSL_OP_NO_TLSv1_2;
|
|
165
|
+
// }
|
|
166
|
+
|
|
167
|
+
const auth = args.auth || parsedUrl.auth;
|
|
168
|
+
if (auth) {
|
|
169
|
+
options.auth = auth;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// content undefined data 有值
|
|
173
|
+
let body = args.content || args.data;
|
|
174
|
+
const dataAsQueryString = method === 'GET' || method === 'HEAD' || args.dataAsQueryString;
|
|
175
|
+
if (!args.content) {
|
|
176
|
+
if (body && !(typeof body === 'string' || Buffer.isBuffer(body))) {
|
|
177
|
+
if (dataAsQueryString) {
|
|
178
|
+
// read: GET, HEAD, use query string
|
|
179
|
+
body = args.nestedQuerystring ? qs.stringify(body) : querystring.stringify(body);
|
|
180
|
+
} else {
|
|
181
|
+
let contentType = options.headers['Content-Type'] || options.headers['content-type'];
|
|
182
|
+
// auto add application/x-www-form-urlencoded when using urlencode form request
|
|
183
|
+
if (!contentType) {
|
|
184
|
+
if (args.contentType === 'json') {
|
|
185
|
+
contentType = 'application/json';
|
|
186
|
+
} else {
|
|
187
|
+
contentType = 'application/x-www-form-urlencoded';
|
|
188
|
+
}
|
|
189
|
+
options.headers['Content-Type'] = contentType;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (parseContentType(contentType) === 'application/json') {
|
|
193
|
+
body = JSON.stringify(body);
|
|
194
|
+
} else {
|
|
195
|
+
// 'application/x-www-form-urlencoded'
|
|
196
|
+
body = args.nestedQuerystring ? qs.stringify(body) : querystring.stringify(body);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// if it's a GET or HEAD request, data should be sent as query string
|
|
203
|
+
if (dataAsQueryString && body) {
|
|
204
|
+
options.path += (parsedUrl.query ? '&' : '?') + body;
|
|
205
|
+
body = null;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
let requestSize = 0;
|
|
209
|
+
if (body) {
|
|
210
|
+
let length = body.length;
|
|
211
|
+
if (!Buffer.isBuffer(body)) {
|
|
212
|
+
length = Buffer.byteLength(body);
|
|
213
|
+
}
|
|
214
|
+
requestSize = options.headers['Content-Length'] = length;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (args.dataType === 'json') {
|
|
218
|
+
options.headers.Accept = 'application/json';
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (typeof args.beforeRequest === 'function') {
|
|
222
|
+
// you can use this hook to change every thing.
|
|
223
|
+
args.beforeRequest(options);
|
|
224
|
+
}
|
|
225
|
+
let connectTimer = null;
|
|
226
|
+
let responseTimer = null;
|
|
227
|
+
let __err = null;
|
|
228
|
+
let connected = false; // socket connected or not
|
|
229
|
+
let keepAliveSocket = false; // request with keepalive socket
|
|
230
|
+
let responseSize = 0;
|
|
231
|
+
let statusCode = -1;
|
|
232
|
+
let responseAborted = false;
|
|
233
|
+
let remoteAddress = '';
|
|
234
|
+
let remotePort = '';
|
|
235
|
+
let timing = null;
|
|
236
|
+
if (args.timing) {
|
|
237
|
+
timing = {
|
|
238
|
+
// socket assigned
|
|
239
|
+
queuing: 0,
|
|
240
|
+
// dns lookup time
|
|
241
|
+
dnslookup: 0,
|
|
242
|
+
// socket connected
|
|
243
|
+
connected: 0,
|
|
244
|
+
// request sent
|
|
245
|
+
requestSent: 0,
|
|
246
|
+
// Time to first byte (TTFB)
|
|
247
|
+
waiting: 0,
|
|
248
|
+
contentDownload: 0
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function cancelConnectTimer() {
|
|
253
|
+
if (connectTimer) {
|
|
254
|
+
clearTimeout(connectTimer);
|
|
255
|
+
connectTimer = null;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function cancelResponseTimer() {
|
|
259
|
+
if (responseTimer) {
|
|
260
|
+
clearTimeout(responseTimer);
|
|
261
|
+
responseTimer = null;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function done(err, data, res) {
|
|
266
|
+
cancelResponseTimer();
|
|
267
|
+
if (!callback) {
|
|
268
|
+
console.warn(
|
|
269
|
+
'[urllib:warn] [%s] [%s] [worker:%s] %s %s callback twice!!!',
|
|
270
|
+
Date(),
|
|
271
|
+
reqId,
|
|
272
|
+
process.pid,
|
|
273
|
+
options.method,
|
|
274
|
+
url
|
|
275
|
+
);
|
|
276
|
+
// https://github.com/node-modules/urllib/pull/30
|
|
277
|
+
if (err) {
|
|
278
|
+
console.warn(
|
|
279
|
+
'[urllib:warn] [%s] [%s] [worker:%s] %s: %s\nstack: %s',
|
|
280
|
+
Date(),
|
|
281
|
+
reqId,
|
|
282
|
+
process.pid,
|
|
283
|
+
err.name,
|
|
284
|
+
err.message,
|
|
285
|
+
err.stack
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const cb = callback;
|
|
291
|
+
callback = null;
|
|
292
|
+
let headers = {};
|
|
293
|
+
if (res) {
|
|
294
|
+
statusCode = res.statusCode;
|
|
295
|
+
headers = res.headers;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// handle digest auth
|
|
299
|
+
// if (statusCode === 401 && headers['www-authenticate']
|
|
300
|
+
// && (!args.headers || !args.headers.Authorization) && args.digestAuth) {
|
|
301
|
+
// const authenticate = headers['www-authenticate'];
|
|
302
|
+
// if (authenticate.indexOf('Digest ') >= 0) {
|
|
303
|
+
// debug('Request#%d %s: got digest auth header WWW-Authenticate: %s', reqId, url, authenticate);
|
|
304
|
+
// args.headers = args.headers || {};
|
|
305
|
+
// args.headers.Authorization = digestAuthHeader(options.method, options.path, authenticate, args.digestAuth);
|
|
306
|
+
// debug('Request#%d %s: auth with digest header: %s', reqId, url, args.headers.Authorization);
|
|
307
|
+
// if (res.headers['set-cookie']) {
|
|
308
|
+
// args.headers.Cookie = res.headers['set-cookie'].join(';');
|
|
309
|
+
// }
|
|
310
|
+
// return exports.requestWithCallback(url, args, cb);
|
|
311
|
+
// }
|
|
312
|
+
// }
|
|
313
|
+
|
|
314
|
+
const requestUseTime = Date.now() - requestStartTime;
|
|
315
|
+
if (timing) {
|
|
316
|
+
timing.contentDownload = requestUseTime;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
debug(
|
|
320
|
+
'[%sms] done, %s bytes HTTP %s %s %s %s, keepAliveSocket: %s, timing: %j',
|
|
321
|
+
requestUseTime,
|
|
322
|
+
responseSize,
|
|
323
|
+
statusCode,
|
|
324
|
+
options.method,
|
|
325
|
+
options.host,
|
|
326
|
+
options.path,
|
|
327
|
+
keepAliveSocket,
|
|
328
|
+
timing
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
const response = {
|
|
332
|
+
status: statusCode,
|
|
333
|
+
statusCode: statusCode,
|
|
334
|
+
headers: headers,
|
|
335
|
+
size: responseSize,
|
|
336
|
+
aborted: responseAborted,
|
|
337
|
+
rt: requestUseTime,
|
|
338
|
+
keepAliveSocket: keepAliveSocket,
|
|
339
|
+
data: data,
|
|
340
|
+
requestUrls: args.requestUrls,
|
|
341
|
+
timing: timing,
|
|
342
|
+
remoteAddress: remoteAddress,
|
|
343
|
+
remotePort: remotePort
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
if (err) {
|
|
347
|
+
let agentStatus = '';
|
|
348
|
+
if (agent && typeof agent.getCurrentStatus === 'function') {
|
|
349
|
+
// add current agent status to error message for logging and debug
|
|
350
|
+
agentStatus = ', agent status: ' + JSON.stringify(agent.getCurrentStatus());
|
|
351
|
+
}
|
|
352
|
+
err.message +=
|
|
353
|
+
', ' +
|
|
354
|
+
options.method +
|
|
355
|
+
' ' +
|
|
356
|
+
url +
|
|
357
|
+
' ' +
|
|
358
|
+
statusCode +
|
|
359
|
+
' (connected: ' +
|
|
360
|
+
connected +
|
|
361
|
+
', keepalive socket: ' +
|
|
362
|
+
keepAliveSocket +
|
|
363
|
+
agentStatus +
|
|
364
|
+
')' +
|
|
365
|
+
'\nheaders: ' +
|
|
366
|
+
JSON.stringify(headers);
|
|
367
|
+
err.data = data;
|
|
368
|
+
err.path = options.path;
|
|
369
|
+
err.status = statusCode;
|
|
370
|
+
err.headers = headers;
|
|
371
|
+
err.res = response;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
cb(err, data, args.streaming ? res : response);
|
|
375
|
+
|
|
376
|
+
if (args.emitter) {
|
|
377
|
+
// keep to use the same reqMeta object on request event before
|
|
378
|
+
reqMeta.url = url;
|
|
379
|
+
reqMeta.socket = req && req.connection;
|
|
380
|
+
reqMeta.options = options;
|
|
381
|
+
reqMeta.size = requestSize;
|
|
382
|
+
|
|
383
|
+
args.emitter.emit('response', {
|
|
384
|
+
requestId: reqId,
|
|
385
|
+
error: err,
|
|
386
|
+
ctx: args.ctx,
|
|
387
|
+
req: reqMeta,
|
|
388
|
+
res: response
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function handleRedirect(res) {
|
|
394
|
+
let err = null;
|
|
395
|
+
if (args.followRedirect && statuses.redirect[res.statusCode]) {
|
|
396
|
+
// handle redirect
|
|
397
|
+
args._followRedirectCount = (args._followRedirectCount || 0) + 1;
|
|
398
|
+
const location = res.headers.location;
|
|
399
|
+
if (!location) {
|
|
400
|
+
err = new Error('Got statusCode ' + res.statusCode + ' but cannot resolve next location from headers');
|
|
401
|
+
err.name = 'FollowRedirectError';
|
|
402
|
+
} else if (args._followRedirectCount > args.maxRedirects) {
|
|
403
|
+
err = new Error('Exceeded maxRedirects. Probably stuck in a redirect loop ' + url);
|
|
404
|
+
err.name = 'MaxRedirectError';
|
|
405
|
+
} else {
|
|
406
|
+
const newUrl = args.formatRedirectUrl ? args.formatRedirectUrl(url, location) : urlutil.resolve(url, location);
|
|
407
|
+
debug('Request#%d %s: `redirected` from %s to %s', reqId, options.path, url, newUrl);
|
|
408
|
+
// make sure timer stop
|
|
409
|
+
cancelResponseTimer();
|
|
410
|
+
// should clean up headers.Host on `location: http://other-domain/url`
|
|
411
|
+
if (args.headers && args.headers.Host && PROTO_RE.test(location)) {
|
|
412
|
+
args.headers.Host = null;
|
|
413
|
+
}
|
|
414
|
+
// avoid done will be execute in the future change.
|
|
415
|
+
const cb = callback;
|
|
416
|
+
callback = null;
|
|
417
|
+
exports.requestWithCallback(newUrl, args, cb);
|
|
418
|
+
return {
|
|
419
|
+
redirect: true,
|
|
420
|
+
error: null
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
redirect: false,
|
|
426
|
+
error: err
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
if (args.gzip) {
|
|
431
|
+
if (!options.headers['Accept-Encoding'] && !options.headers['accept-encoding']) {
|
|
432
|
+
options.headers['Accept-Encoding'] = 'gzip';
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function decodeContent(res, body, cb) {
|
|
437
|
+
const encoding = res.headers['content-encoding'];
|
|
438
|
+
// if (body.length === 0) {
|
|
439
|
+
// return cb(null, body, encoding);
|
|
440
|
+
// }
|
|
441
|
+
|
|
442
|
+
// if (!encoding || encoding.toLowerCase() !== 'gzip') {
|
|
443
|
+
return cb(null, body, encoding);
|
|
444
|
+
// }
|
|
445
|
+
|
|
446
|
+
// debug('gunzip %d length body', body.length);
|
|
447
|
+
// zlib.gunzip(body, cb);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
const writeStream = args.writeStream;
|
|
451
|
+
|
|
452
|
+
debug('Request#%d %s %s with headers %j, options.path: %s', reqId, method, url, options.headers, options.path);
|
|
453
|
+
|
|
454
|
+
args.requestUrls.push(url);
|
|
455
|
+
|
|
456
|
+
function onResponse(res) {
|
|
457
|
+
if (timing) {
|
|
458
|
+
timing.waiting = Date.now() - requestStartTime;
|
|
459
|
+
}
|
|
460
|
+
debug('Request#%d %s `req response` event emit: status %d, headers: %j', reqId, url, res.statusCode, res.headers);
|
|
461
|
+
|
|
462
|
+
if (args.streaming) {
|
|
463
|
+
const result = handleRedirect(res);
|
|
464
|
+
if (result.redirect) {
|
|
465
|
+
res.resume();
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (result.error) {
|
|
469
|
+
res.resume();
|
|
470
|
+
return done(result.error, null, res);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return done(null, null, res);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
res.on('close', function () {
|
|
477
|
+
debug('Request#%d %s: `res close` event emit, total size %d', reqId, url, responseSize);
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
res.on('error', function () {
|
|
481
|
+
debug('Request#%d %s: `res error` event emit, total size %d', reqId, url, responseSize);
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
res.on('aborted', function () {
|
|
485
|
+
responseAborted = true;
|
|
486
|
+
debug('Request#%d %s: `res aborted` event emit, total size %d', reqId, url, responseSize);
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
if (writeStream) {
|
|
490
|
+
// If there's a writable stream to recieve the response data, just pipe the
|
|
491
|
+
// response stream to that writable stream and call the callback when it has
|
|
492
|
+
// finished writing.
|
|
493
|
+
//
|
|
494
|
+
// NOTE that when the response stream `res` emits an 'end' event it just
|
|
495
|
+
// means that it has finished piping data to another stream. In the
|
|
496
|
+
// meanwhile that writable stream may still writing data to the disk until
|
|
497
|
+
// it emits a 'close' event.
|
|
498
|
+
//
|
|
499
|
+
// That means that we should not apply callback until the 'close' of the
|
|
500
|
+
// writable stream is emited.
|
|
501
|
+
//
|
|
502
|
+
// See also:
|
|
503
|
+
// - https://github.com/TBEDP/urllib/commit/959ac3365821e0e028c231a5e8efca6af410eabb
|
|
504
|
+
// - http://nodejs.org/api/stream.html#stream_event_end
|
|
505
|
+
// - http://nodejs.org/api/stream.html#stream_event_close_1
|
|
506
|
+
const result = handleRedirect(res);
|
|
507
|
+
if (result.redirect) {
|
|
508
|
+
res.resume();
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
if (result.error) {
|
|
512
|
+
res.resume();
|
|
513
|
+
// end ths stream first
|
|
514
|
+
writeStream.end();
|
|
515
|
+
return done(result.error, null, res);
|
|
516
|
+
}
|
|
517
|
+
// you can set consumeWriteStream false that only wait response end
|
|
518
|
+
if (args.consumeWriteStream === false) {
|
|
519
|
+
res.on('end', done.bind(null, null, null, res));
|
|
520
|
+
} else {
|
|
521
|
+
// node 0.10, 0.12: only emit res aborted, writeStream close not fired
|
|
522
|
+
// if (isNode010 || isNode012) {
|
|
523
|
+
// first([
|
|
524
|
+
// [ writeStream, 'close' ],
|
|
525
|
+
// [ res, 'aborted' ],
|
|
526
|
+
// ], function(_, stream, event) {
|
|
527
|
+
// debug('Request#%d %s: writeStream or res %s event emitted', reqId, url, event);
|
|
528
|
+
// done(__err || null, null, res);
|
|
529
|
+
// });
|
|
530
|
+
if (false) {
|
|
531
|
+
} else {
|
|
532
|
+
writeStream.on('close', function () {
|
|
533
|
+
debug('Request#%d %s: writeStream close event emitted', reqId, url);
|
|
534
|
+
done(__err || null, null, res);
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
return res.pipe(writeStream);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// Otherwise, just concat those buffers.
|
|
542
|
+
//
|
|
543
|
+
// NOTE that the `chunk` is not a String but a Buffer. It means that if
|
|
544
|
+
// you simply concat two chunk with `+` you're actually converting both
|
|
545
|
+
// Buffers into Strings before concating them. It'll cause problems when
|
|
546
|
+
// dealing with multi-byte characters.
|
|
547
|
+
//
|
|
548
|
+
// The solution is to store each chunk in an array and concat them with
|
|
549
|
+
// 'buffer-concat' when all chunks is recieved.
|
|
550
|
+
//
|
|
551
|
+
// See also:
|
|
552
|
+
// http://cnodejs.org/topic/4faf65852e8fb5bc65113403
|
|
553
|
+
|
|
554
|
+
const chunks = [];
|
|
555
|
+
|
|
556
|
+
res.on('data', function (chunk) {
|
|
557
|
+
debug('Request#%d %s: `res data` event emit, size %d', reqId, url, chunk.length);
|
|
558
|
+
responseSize += chunk.length;
|
|
559
|
+
chunks.push(chunk);
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
res.on('end', function () {
|
|
563
|
+
const body = Buffer.concat(chunks, responseSize);
|
|
564
|
+
debug('Request#%d %s: `res end` event emit, total size %d, _dumped: %s', reqId, url, responseSize, res._dumped);
|
|
565
|
+
|
|
566
|
+
if (__err) {
|
|
567
|
+
// req.abort() after `res data` event emit.
|
|
568
|
+
return done(__err, body, res);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
const result = handleRedirect(res);
|
|
572
|
+
if (result.error) {
|
|
573
|
+
return done(result.error, body, res);
|
|
574
|
+
}
|
|
575
|
+
if (result.redirect) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
decodeContent(res, body, function (err, data, encoding) {
|
|
580
|
+
if (err) {
|
|
581
|
+
return done(err, body, res);
|
|
582
|
+
}
|
|
583
|
+
// if body not decode, dont touch it
|
|
584
|
+
if (!encoding && TEXT_DATA_TYPES.indexOf(args.dataType) >= 0) {
|
|
585
|
+
// try to decode charset
|
|
586
|
+
try {
|
|
587
|
+
data = decodeBodyByCharset(data, res);
|
|
588
|
+
} catch (e) {
|
|
589
|
+
debug('decodeBodyByCharset error: %s', e);
|
|
590
|
+
// if error, dont touch it
|
|
591
|
+
return done(null, data, res);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
if (args.dataType === 'json') {
|
|
595
|
+
if (responseSize === 0) {
|
|
596
|
+
data = null;
|
|
597
|
+
} else {
|
|
598
|
+
const r = parseJSON(data, fixJSONCtlChars);
|
|
599
|
+
if (r.error) {
|
|
600
|
+
err = r.error;
|
|
601
|
+
} else {
|
|
602
|
+
data = r.data;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
if (responseAborted) {
|
|
609
|
+
// err = new Error('Remote socket was terminated before `response.end()` was called');
|
|
610
|
+
// err.name = 'RemoteSocketClosedError';
|
|
611
|
+
debug('Request#%d %s: Remote socket was terminated before `response.end()` was called', reqId, url);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
done(err, data, res);
|
|
615
|
+
});
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
let connectTimeout, responseTimeout;
|
|
620
|
+
if (Array.isArray(args.timeout)) {
|
|
621
|
+
connectTimeout = ms(args.timeout[0]);
|
|
622
|
+
responseTimeout = ms(args.timeout[1]);
|
|
623
|
+
} else {
|
|
624
|
+
// set both timeout equal
|
|
625
|
+
connectTimeout = responseTimeout = ms(args.timeout);
|
|
626
|
+
}
|
|
627
|
+
debug('ConnectTimeout: %d, ResponseTimeout: %d', connectTimeout, responseTimeout);
|
|
628
|
+
|
|
629
|
+
function startConnectTimer() {
|
|
630
|
+
debug('Connect timer ticking, timeout: %d', connectTimeout);
|
|
631
|
+
connectTimer = setTimeout(function () {
|
|
632
|
+
connectTimer = null;
|
|
633
|
+
if (statusCode === -1) {
|
|
634
|
+
statusCode = -2;
|
|
635
|
+
}
|
|
636
|
+
let msg = 'Connect timeout for ' + connectTimeout + 'ms';
|
|
637
|
+
let errorName = 'ConnectionTimeoutError';
|
|
638
|
+
if (!req.socket) {
|
|
639
|
+
errorName = 'SocketAssignTimeoutError';
|
|
640
|
+
msg += ', working sockets is full';
|
|
641
|
+
}
|
|
642
|
+
__err = new Error(msg);
|
|
643
|
+
__err.name = errorName;
|
|
644
|
+
__err.requestId = reqId;
|
|
645
|
+
debug('ConnectTimeout: Request#%d %s %s: %s, connected: %s', reqId, url, __err.name, msg, connected);
|
|
646
|
+
abortRequest();
|
|
647
|
+
}, connectTimeout);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
function startResposneTimer() {
|
|
651
|
+
debug('Response timer ticking, timeout: %d', responseTimeout);
|
|
652
|
+
responseTimer = setTimeout(function () {
|
|
653
|
+
responseTimer = null;
|
|
654
|
+
const msg = 'Response timeout for ' + responseTimeout + 'ms';
|
|
655
|
+
const errorName = 'ResponseTimeoutError';
|
|
656
|
+
__err = new Error(msg);
|
|
657
|
+
__err.name = errorName;
|
|
658
|
+
__err.requestId = reqId;
|
|
659
|
+
debug('ResponseTimeout: Request#%d %s %s: %s, connected: %s', reqId, url, __err.name, msg, connected);
|
|
660
|
+
abortRequest();
|
|
661
|
+
}, responseTimeout);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
let req;
|
|
665
|
+
// request headers checker will throw error
|
|
666
|
+
options.mode = args.mode ? args.mode : '';
|
|
667
|
+
try {
|
|
668
|
+
req = httplib.request(options, onResponse);
|
|
669
|
+
} catch (err) {
|
|
670
|
+
return done(err);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// environment detection: browser or nodejs
|
|
674
|
+
if (typeof window === 'undefined') {
|
|
675
|
+
// start connect timer just after `request` return, and just in nodejs environment
|
|
676
|
+
startConnectTimer();
|
|
677
|
+
} else {
|
|
678
|
+
req.on('requestTimeout', function () {
|
|
679
|
+
if (statusCode === -1) {
|
|
680
|
+
statusCode = -2;
|
|
681
|
+
}
|
|
682
|
+
const msg = 'Connect timeout for ' + connectTimeout + 'ms';
|
|
683
|
+
const errorName = 'ConnectionTimeoutError';
|
|
684
|
+
__err = new Error(msg);
|
|
685
|
+
__err.name = errorName;
|
|
686
|
+
__err.requestId = reqId;
|
|
687
|
+
abortRequest();
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
function abortRequest() {
|
|
692
|
+
debug('Request#%d %s abort, connected: %s', reqId, url, connected);
|
|
693
|
+
// it wont case error event when req haven't been assigned a socket yet.
|
|
694
|
+
if (!req.socket) {
|
|
695
|
+
__err.noSocket = true;
|
|
696
|
+
done(__err);
|
|
697
|
+
}
|
|
698
|
+
req.abort();
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
if (timing) {
|
|
702
|
+
// request sent
|
|
703
|
+
req.on('finish', function () {
|
|
704
|
+
timing.requestSent = Date.now() - requestStartTime;
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
req.once('socket', function (socket) {
|
|
709
|
+
if (timing) {
|
|
710
|
+
// socket queuing time
|
|
711
|
+
timing.queuing = Date.now() - requestStartTime;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// https://github.com/nodejs/node/blob/master/lib/net.js#L377
|
|
715
|
+
// https://github.com/nodejs/node/blob/v0.10.40-release/lib/net.js#L352
|
|
716
|
+
// should use socket.socket on 0.10.x
|
|
717
|
+
// if (isNode010 && socket.socket) {
|
|
718
|
+
// socket = socket.socket;
|
|
719
|
+
// }
|
|
720
|
+
|
|
721
|
+
const readyState = socket.readyState;
|
|
722
|
+
if (readyState === 'opening') {
|
|
723
|
+
socket.once('lookup', function (err, ip, addressType) {
|
|
724
|
+
debug('Request#%d %s lookup: %s, %s, %s', reqId, url, err, ip, addressType);
|
|
725
|
+
if (timing) {
|
|
726
|
+
timing.dnslookup = Date.now() - requestStartTime;
|
|
727
|
+
}
|
|
728
|
+
if (ip) {
|
|
729
|
+
remoteAddress = ip;
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
socket.once('connect', function () {
|
|
733
|
+
if (timing) {
|
|
734
|
+
// socket connected
|
|
735
|
+
timing.connected = Date.now() - requestStartTime;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
// cancel socket timer at first and start tick for TTFB
|
|
739
|
+
cancelConnectTimer();
|
|
740
|
+
startResposneTimer();
|
|
741
|
+
|
|
742
|
+
debug('Request#%d %s new socket connected', reqId, url);
|
|
743
|
+
connected = true;
|
|
744
|
+
if (!remoteAddress) {
|
|
745
|
+
remoteAddress = socket.remoteAddress;
|
|
746
|
+
}
|
|
747
|
+
remotePort = socket.remotePort;
|
|
748
|
+
});
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
debug('Request#%d %s reuse socket connected, readyState: %s', reqId, url, readyState);
|
|
753
|
+
connected = true;
|
|
754
|
+
keepAliveSocket = true;
|
|
755
|
+
if (!remoteAddress) {
|
|
756
|
+
remoteAddress = socket.remoteAddress;
|
|
757
|
+
}
|
|
758
|
+
remotePort = socket.remotePort;
|
|
759
|
+
|
|
760
|
+
// reuse socket, timer should be canceled.
|
|
761
|
+
cancelConnectTimer();
|
|
762
|
+
startResposneTimer();
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
req.on('error', function (err) {
|
|
766
|
+
//TypeError for browser fetch api, Error for browser xmlhttprequest api
|
|
767
|
+
if (err.name === 'Error' || err.name === 'TypeError') {
|
|
768
|
+
err.name = connected ? 'ResponseError' : 'RequestError';
|
|
769
|
+
}
|
|
770
|
+
err.message += ' (req "error")';
|
|
771
|
+
debug('Request#%d %s `req error` event emit, %s: %s', reqId, url, err.name, err.message);
|
|
772
|
+
done(__err || err);
|
|
773
|
+
});
|
|
774
|
+
|
|
775
|
+
if (writeStream) {
|
|
776
|
+
writeStream.once('error', function (err) {
|
|
777
|
+
err.message += ' (writeStream "error")';
|
|
778
|
+
__err = err;
|
|
779
|
+
debug('Request#%d %s `writeStream error` event emit, %s: %s', reqId, url, err.name, err.message);
|
|
780
|
+
abortRequest();
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
if (args.stream) {
|
|
785
|
+
args.stream.pipe(req);
|
|
786
|
+
args.stream.once('error', function (err) {
|
|
787
|
+
err.message += ' (stream "error")';
|
|
788
|
+
__err = err;
|
|
789
|
+
debug('Request#%d %s `readStream error` event emit, %s: %s', reqId, url, err.name, err.message);
|
|
790
|
+
abortRequest();
|
|
791
|
+
});
|
|
792
|
+
} else {
|
|
793
|
+
req.end(body);
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
req.requestId = reqId;
|
|
797
|
+
return req;
|
|
798
|
+
};
|