@zudojs/http 0.0.1
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/README.md +41 -0
- package/dist/httpAdapter/fetch/httpFetch.body.d.ts +20 -0
- package/dist/httpAdapter/fetch/httpFetch.body.d.ts.map +1 -0
- package/dist/httpAdapter/fetch/httpFetch.body.js +57 -0
- package/dist/httpAdapter/fetch/httpFetch.body.js.map +1 -0
- package/dist/httpAdapter/fetch/httpFetch.helper.d.ts.map +1 -0
- package/dist/httpAdapter/fetch/httpFetch.requestContext.d.ts.map +1 -0
- package/dist/httpAdapter/fetch/httpFetch.responseWriter.d.ts.map +1 -0
- package/dist/httpAdapter/fetch/httpFetch.type.d.ts.map +1 -0
- package/dist/httpAdapter/fetch/index.d.ts.map +1 -0
- package/dist/httpAdapter/http.adapter.d.ts +116 -0
- package/dist/httpAdapter/http.adapter.d.ts.map +1 -0
- package/dist/httpAdapter/http.adapter.js +284 -0
- package/dist/httpAdapter/http.adapter.js.map +1 -0
- package/dist/httpAdapter/http.adapters.d.ts.map +1 -0
- package/dist/httpAdapter/http.adapters.js +137 -0
- package/dist/httpAdapter/http.adapters.js.map +1 -0
- package/dist/httpAdapter/httpFetch.adapter.d.ts.map +1 -0
- package/dist/httpAdapter/index.d.ts +10 -0
- package/dist/httpAdapter/index.d.ts.map +1 -0
- package/dist/httpAdapter/index.js +10 -0
- package/dist/httpAdapter/index.js.map +1 -0
- package/dist/httpAdapter/node/httpNode.adapter.d.ts +42 -0
- package/dist/httpAdapter/node/httpNode.adapter.d.ts.map +1 -0
- package/dist/httpAdapter/node/httpNode.adapter.js +221 -0
- package/dist/httpAdapter/node/httpNode.adapter.js.map +1 -0
- package/dist/httpAdapter/node/httpNode.request.d.ts.map +1 -0
- package/dist/httpAdapter/node/httpNode.response.d.ts.map +1 -0
- package/dist/httpAdapter/node/httpNode.server.d.ts +39 -0
- package/dist/httpAdapter/node/httpNode.server.d.ts.map +1 -0
- package/dist/httpAdapter/node/httpNode.server.js +228 -0
- package/dist/httpAdapter/node/httpNode.server.js.map +1 -0
- package/dist/httpAdapter/node/httpNode.type.d.ts.map +1 -0
- package/dist/httpAdapter/node/index.d.ts +11 -0
- package/dist/httpAdapter/node/index.d.ts.map +1 -0
- package/dist/httpAdapter/node/index.js +11 -0
- package/dist/httpAdapter/node/index.js.map +1 -0
- package/dist/httpAgent/http.agent.d.ts.map +1 -0
- package/dist/httpAgent/index.d.ts +7 -0
- package/dist/httpAgent/index.d.ts.map +1 -0
- package/dist/httpAgent/index.js +7 -0
- package/dist/httpAgent/index.js.map +1 -0
- package/dist/httpBody/http.body.d.ts +36 -0
- package/dist/httpBody/http.body.d.ts.map +1 -0
- package/dist/httpBody/http.body.js +245 -0
- package/dist/httpBody/http.body.js.map +1 -0
- package/dist/httpBody/httpBody.formData.d.ts +48 -0
- package/dist/httpBody/httpBody.formData.d.ts.map +1 -0
- package/dist/httpBody/httpBody.formData.js +366 -0
- package/dist/httpBody/httpBody.formData.js.map +1 -0
- package/dist/httpBody/httpBody.parser.d.ts +44 -0
- package/dist/httpBody/httpBody.parser.d.ts.map +1 -0
- package/dist/httpBody/httpBody.parser.js +233 -0
- package/dist/httpBody/httpBody.parser.js.map +1 -0
- package/dist/httpBody/index.d.ts +9 -0
- package/dist/httpBody/index.d.ts.map +1 -0
- package/dist/httpBody/index.js +9 -0
- package/dist/httpBody/index.js.map +1 -0
- package/dist/httpCacheControl/core/httpCacheControl.parse.d.ts.map +1 -0
- package/dist/httpCacheControl/core/httpCacheControl.type.d.ts.map +1 -0
- package/dist/httpCacheControl/core/httpCacheControl.validation.d.ts.map +1 -0
- package/dist/httpCacheControl/core/index.d.ts.map +1 -0
- package/dist/httpCacheControl/httpCacheControl.core.d.ts.map +1 -0
- package/dist/httpCacheControl/httpCacheControl.factory.d.ts.map +1 -0
- package/dist/httpCacheControl/httpCacheControl.freshness.d.ts.map +1 -0
- package/dist/httpCacheControl/httpCacheControl.requestHelper.d.ts.map +1 -0
- package/dist/httpCacheControl/httpCacheControl.responseHelper.d.ts.map +1 -0
- package/dist/httpCacheControl/index.d.ts +7 -0
- package/dist/httpCacheControl/index.d.ts.map +1 -0
- package/dist/httpCacheControl/index.js +7 -0
- package/dist/httpCacheControl/index.js.map +1 -0
- package/dist/httpClient/httpClient.abort.d.ts.map +1 -0
- package/dist/httpClient/httpClient.body.d.ts.map +1 -0
- package/dist/httpClient/httpClient.client.d.ts.map +1 -0
- package/dist/httpClient/httpClient.context.d.ts.map +1 -0
- package/dist/httpClient/httpClient.error.d.ts +9 -0
- package/dist/httpClient/httpClient.error.d.ts.map +1 -0
- package/dist/httpClient/httpClient.error.js +9 -0
- package/dist/httpClient/httpClient.error.js.map +1 -0
- package/dist/httpClient/httpClient.errorNormalizer.d.ts.map +1 -0
- package/dist/httpClient/httpClient.executor.d.ts.map +1 -0
- package/dist/httpClient/httpClient.factory.d.ts.map +1 -0
- package/dist/httpClient/httpClient.headers.d.ts.map +1 -0
- package/dist/httpClient/httpClient.helpers.d.ts.map +1 -0
- package/dist/httpClient/httpClient.interceptors.d.ts.map +1 -0
- package/dist/httpClient/httpClient.methods.d.ts.map +1 -0
- package/dist/httpClient/httpClient.response.d.ts.map +1 -0
- package/dist/httpClient/httpClient.retry.d.ts +38 -0
- package/dist/httpClient/httpClient.retry.d.ts.map +1 -0
- package/dist/httpClient/httpClient.retry.js +61 -0
- package/dist/httpClient/httpClient.retry.js.map +1 -0
- package/dist/httpClient/httpClient.type.d.ts.map +1 -0
- package/dist/httpClient/httpClient.typeGuards.d.ts.map +1 -0
- package/dist/httpClient/httpClient.url.d.ts.map +1 -0
- package/dist/httpClient/index.d.ts +17 -0
- package/dist/httpClient/index.d.ts.map +1 -0
- package/dist/httpClient/index.js +17 -0
- package/dist/httpClient/index.js.map +1 -0
- package/dist/httpCompression/http.compression.d.ts.map +1 -0
- package/dist/httpCompression/index.d.ts +7 -0
- package/dist/httpCompression/index.d.ts.map +1 -0
- package/dist/httpCompression/index.js +7 -0
- package/dist/httpCompression/index.js.map +1 -0
- package/dist/httpConditional/httpConditional.core.d.ts.map +1 -0
- package/dist/httpConditional/index.d.ts +7 -0
- package/dist/httpConditional/index.d.ts.map +1 -0
- package/dist/httpConditional/index.js +7 -0
- package/dist/httpConditional/index.js.map +1 -0
- package/dist/httpConstants/http.constants.d.ts +171 -0
- package/dist/httpConstants/http.constants.d.ts.map +1 -0
- package/dist/httpConstants/http.constants.js +294 -0
- package/dist/httpConstants/http.constants.js.map +1 -0
- package/dist/httpConstants/index.d.ts +7 -0
- package/dist/httpConstants/index.d.ts.map +1 -0
- package/dist/httpConstants/index.js +7 -0
- package/dist/httpConstants/index.js.map +1 -0
- package/dist/httpContentDisposition/httpContentDisposition.core.d.ts.map +1 -0
- package/dist/httpContentDisposition/index.d.ts +7 -0
- package/dist/httpContentDisposition/index.d.ts.map +1 -0
- package/dist/httpContentDisposition/index.js +7 -0
- package/dist/httpContentDisposition/index.js.map +1 -0
- package/dist/httpContentType/httpContentType.boundary.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.category.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.categoryBinary.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.charset.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.constructors.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.formatter.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.matcher.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.mediaTypes.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.normalizer.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.parameter.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.parser.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.parserHelpers.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.type.d.ts.map +1 -0
- package/dist/httpContentType/index.d.ts +19 -0
- package/dist/httpContentType/index.d.ts.map +1 -0
- package/dist/httpContentType/index.js +19 -0
- package/dist/httpContentType/index.js.map +1 -0
- package/dist/httpContext/http.context.d.ts +45 -0
- package/dist/httpContext/http.context.d.ts.map +1 -0
- package/dist/httpContext/http.context.js +157 -0
- package/dist/httpContext/http.context.js.map +1 -0
- package/dist/httpContext/index.d.ts +7 -0
- package/dist/httpContext/index.d.ts.map +1 -0
- package/dist/httpContext/index.js +7 -0
- package/dist/httpContext/index.js.map +1 -0
- package/dist/httpCookies/http.cookies.d.ts.map +1 -0
- package/dist/httpCookies/index.d.ts +7 -0
- package/dist/httpCookies/index.d.ts.map +1 -0
- package/dist/httpCookies/index.js +7 -0
- package/dist/httpCookies/index.js.map +1 -0
- package/dist/httpCors/http.cors.d.ts.map +1 -0
- package/dist/httpCors/index.d.ts +7 -0
- package/dist/httpCors/index.d.ts.map +1 -0
- package/dist/httpCors/index.js +7 -0
- package/dist/httpCors/index.js.map +1 -0
- package/dist/httpCsp/checks/httpCsp.checks.d.ts.map +1 -0
- package/dist/httpCsp/checks/index.d.ts.map +1 -0
- package/dist/httpCsp/formatting/httpCsp.formatting.d.ts.map +1 -0
- package/dist/httpCsp/formatting/index.d.ts.map +1 -0
- package/dist/httpCsp/index.d.ts +19 -0
- package/dist/httpCsp/index.d.ts.map +1 -0
- package/dist/httpCsp/index.js +17 -0
- package/dist/httpCsp/index.js.map +1 -0
- package/dist/httpCsp/internal/httpCsp.internal.d.ts.map +1 -0
- package/dist/httpCsp/internal/index.d.ts.map +1 -0
- package/dist/httpCsp/nonce/httpCsp.nonce.d.ts.map +1 -0
- package/dist/httpCsp/nonce/index.d.ts.map +1 -0
- package/dist/httpCsp/parsing/httpCsp.parsing.d.ts.map +1 -0
- package/dist/httpCsp/parsing/index.d.ts.map +1 -0
- package/dist/httpCsp/policies/httpCsp.policies.d.ts.map +1 -0
- package/dist/httpCsp/policies/index.d.ts.map +1 -0
- package/dist/httpCsp/reportOnly/httpCsp.reportOnly.d.ts.map +1 -0
- package/dist/httpCsp/reportOnly/index.d.ts.map +1 -0
- package/dist/httpCsp/sources/httpCsp.sources.d.ts.map +1 -0
- package/dist/httpCsp/sources/index.d.ts.map +1 -0
- package/dist/httpCsp/types/httpCsp.constant.d.ts.map +1 -0
- package/dist/httpCsp/types/httpCsp.type.d.ts.map +1 -0
- package/dist/httpCsp/types/index.d.ts.map +1 -0
- package/dist/httpCsp/validation/httpCsp.validate.d.ts.map +1 -0
- package/dist/httpCsp/validation/httpCsp.validation.d.ts.map +1 -0
- package/dist/httpCsp/validation/index.d.ts.map +1 -0
- package/dist/httpErrors/factories/httpError.clientError.d.ts.map +1 -0
- package/dist/httpErrors/factories/httpError.serverError.d.ts.map +1 -0
- package/dist/httpErrors/httpError.base.d.ts +42 -0
- package/dist/httpErrors/httpError.base.d.ts.map +1 -0
- package/dist/httpErrors/httpError.base.js +73 -0
- package/dist/httpErrors/httpError.base.js.map +1 -0
- package/dist/httpErrors/httpError.helper.d.ts.map +1 -0
- package/dist/httpErrors/httpError.invalidJson.d.ts.map +1 -0
- package/dist/httpErrors/httpError.type.d.ts +69 -0
- package/dist/httpErrors/httpError.type.d.ts.map +1 -0
- package/dist/httpErrors/httpError.type.js +7 -0
- package/dist/httpErrors/httpError.type.js.map +1 -0
- package/dist/httpErrors/httpError.typeGuard.d.ts.map +1 -0
- package/dist/httpErrors/index.d.ts +13 -0
- package/dist/httpErrors/index.d.ts.map +1 -0
- package/dist/httpErrors/index.js +13 -0
- package/dist/httpErrors/index.js.map +1 -0
- package/dist/httpFormData/index.d.ts +7 -0
- package/dist/httpFormData/index.d.ts.map +1 -0
- package/dist/httpFormData/index.js +7 -0
- package/dist/httpFormData/index.js.map +1 -0
- package/dist/httpHeaders/authorization/httpHeaders.authorization.d.ts.map +1 -0
- package/dist/httpHeaders/authorization/index.d.ts +8 -0
- package/dist/httpHeaders/authorization/index.d.ts.map +1 -0
- package/dist/httpHeaders/authorization/index.js +8 -0
- package/dist/httpHeaders/authorization/index.js.map +1 -0
- package/dist/httpHeaders/basic/httpHeaders.basic.d.ts.map +1 -0
- package/dist/httpHeaders/basic/httpHeaders.basicMatch.d.ts.map +1 -0
- package/dist/httpHeaders/basic/index.d.ts +8 -0
- package/dist/httpHeaders/basic/index.d.ts.map +1 -0
- package/dist/httpHeaders/basic/index.js +8 -0
- package/dist/httpHeaders/basic/index.js.map +1 -0
- package/dist/httpHeaders/cacheControl/httpHeaders.cacheControl.d.ts.map +1 -0
- package/dist/httpHeaders/cacheControl/httpHeaders.cacheControlBuilder.d.ts.map +1 -0
- package/dist/httpHeaders/cacheControl/httpHeaders.cacheControlParse.d.ts.map +1 -0
- package/dist/httpHeaders/cacheControl/httpHeaders.cacheControlTokens.d.ts.map +1 -0
- package/dist/httpHeaders/cacheControl/index.d.ts +10 -0
- package/dist/httpHeaders/cacheControl/index.d.ts.map +1 -0
- package/dist/httpHeaders/cacheControl/index.js +10 -0
- package/dist/httpHeaders/cacheControl/index.js.map +1 -0
- package/dist/httpHeaders/conversion/httpHeaders.conversion.d.ts.map +1 -0
- package/dist/httpHeaders/conversion/httpHeaders.conversionObject.d.ts.map +1 -0
- package/dist/httpHeaders/conversion/index.d.ts +8 -0
- package/dist/httpHeaders/conversion/index.d.ts.map +1 -0
- package/dist/httpHeaders/conversion/index.js +8 -0
- package/dist/httpHeaders/conversion/index.js.map +1 -0
- package/dist/httpHeaders/date/httpHeaders.date.d.ts.map +1 -0
- package/dist/httpHeaders/date/index.d.ts +8 -0
- package/dist/httpHeaders/date/index.d.ts.map +1 -0
- package/dist/httpHeaders/date/index.js +8 -0
- package/dist/httpHeaders/date/index.js.map +1 -0
- package/dist/httpHeaders/etag/httpHeaders.etag.d.ts.map +1 -0
- package/dist/httpHeaders/etag/httpHeaders.etagMatch.d.ts.map +1 -0
- package/dist/httpHeaders/etag/index.d.ts +8 -0
- package/dist/httpHeaders/etag/index.d.ts.map +1 -0
- package/dist/httpHeaders/etag/index.js +8 -0
- package/dist/httpHeaders/etag/index.js.map +1 -0
- package/dist/httpHeaders/forwarded/httpHeaders.forwarded.d.ts.map +1 -0
- package/dist/httpHeaders/forwarded/index.d.ts +8 -0
- package/dist/httpHeaders/forwarded/index.d.ts.map +1 -0
- package/dist/httpHeaders/forwarded/index.js +8 -0
- package/dist/httpHeaders/forwarded/index.js.map +1 -0
- package/dist/httpHeaders/http.headers.d.ts.map +1 -0
- package/dist/httpHeaders/index.d.ts +14 -0
- package/dist/httpHeaders/index.d.ts.map +1 -0
- package/dist/httpHeaders/index.js +14 -0
- package/dist/httpHeaders/index.js.map +1 -0
- package/dist/httpHeaders/internal/httpHeaders.internal.cacheControl.d.ts.map +1 -0
- package/dist/httpHeaders/internal/httpHeaders.internal.mediaType.d.ts.map +1 -0
- package/dist/httpHeaders/internal/httpHeaders.internal.specificity.d.ts.map +1 -0
- package/dist/httpHeaders/internal/httpHeaders.internal.typeGuards.d.ts.map +1 -0
- package/dist/httpHeaders/internal/httpHeaders.internal.weightedValues.d.ts.map +1 -0
- package/dist/httpHeaders/internal/index.d.ts +12 -0
- package/dist/httpHeaders/internal/index.d.ts.map +1 -0
- package/dist/httpHeaders/internal/index.js +12 -0
- package/dist/httpHeaders/internal/index.js.map +1 -0
- package/dist/httpHeaders/list/httpHeaders.list.d.ts.map +1 -0
- package/dist/httpHeaders/list/httpHeaders.listMutation.d.ts.map +1 -0
- package/dist/httpHeaders/list/index.d.ts +8 -0
- package/dist/httpHeaders/list/index.d.ts.map +1 -0
- package/dist/httpHeaders/list/index.js +8 -0
- package/dist/httpHeaders/list/index.js.map +1 -0
- package/dist/httpHeaders/negotiation/httpHeaders.contentNegotiation.d.ts.map +1 -0
- package/dist/httpHeaders/negotiation/httpHeaders.contentNegotiationSelect.d.ts.map +1 -0
- package/dist/httpHeaders/negotiation/httpHeaders.encodingNegotiation.d.ts.map +1 -0
- package/dist/httpHeaders/negotiation/httpHeaders.encodingNegotiationSelect.d.ts.map +1 -0
- package/dist/httpHeaders/negotiation/httpHeaders.languageNegotiation.d.ts.map +1 -0
- package/dist/httpHeaders/negotiation/index.d.ts +11 -0
- package/dist/httpHeaders/negotiation/index.d.ts.map +1 -0
- package/dist/httpHeaders/negotiation/index.js +11 -0
- package/dist/httpHeaders/negotiation/index.js.map +1 -0
- package/dist/httpHeaders/range/httpHeaders.contentRange.d.ts.map +1 -0
- package/dist/httpHeaders/range/httpHeaders.contentRangeParse.d.ts.map +1 -0
- package/dist/httpHeaders/range/httpHeaders.range.d.ts.map +1 -0
- package/dist/httpHeaders/range/httpHeaders.rangeResolution.d.ts.map +1 -0
- package/dist/httpHeaders/range/httpHeaders.rangeSingle.d.ts.map +1 -0
- package/dist/httpHeaders/range/index.d.ts +11 -0
- package/dist/httpHeaders/range/index.d.ts.map +1 -0
- package/dist/httpHeaders/range/index.js +11 -0
- package/dist/httpHeaders/range/index.js.map +1 -0
- package/dist/httpHeaders/security/httpHeaders.security.d.ts.map +1 -0
- package/dist/httpHeaders/security/index.d.ts +8 -0
- package/dist/httpHeaders/security/index.d.ts.map +1 -0
- package/dist/httpHeaders/security/index.js +8 -0
- package/dist/httpHeaders/security/index.js.map +1 -0
- package/dist/httpHeaders/types/httpHeaders.type.d.ts.map +1 -0
- package/dist/httpHeaders/types/index.d.ts +7 -0
- package/dist/httpHeaders/types/index.d.ts.map +1 -0
- package/dist/httpHeaders/types/index.js +7 -0
- package/dist/httpHeaders/types/index.js.map +1 -0
- package/dist/httpHsts/http.hsts.d.ts.map +1 -0
- package/dist/httpHsts/index.d.ts +7 -0
- package/dist/httpHsts/index.d.ts.map +1 -0
- package/dist/httpHsts/index.js +7 -0
- package/dist/httpHsts/index.js.map +1 -0
- package/dist/httpInterceptors/builtin/httpInterceptor.request.d.ts.map +1 -0
- package/dist/httpInterceptors/builtin/httpInterceptor.request.js +79 -0
- package/dist/httpInterceptors/builtin/httpInterceptor.request.js.map +1 -0
- package/dist/httpInterceptors/builtin/httpInterceptor.response.d.ts.map +1 -0
- package/dist/httpInterceptors/builtin/index.d.ts.map +1 -0
- package/dist/httpInterceptors/http.interceptors.d.ts.map +1 -0
- package/dist/httpInterceptors/httpInterceptor.helper.d.ts.map +1 -0
- package/dist/httpInterceptors/httpInterceptor.middleware.d.ts.map +1 -0
- package/dist/httpInterceptors/httpInterceptor.type.d.ts.map +1 -0
- package/dist/httpInterceptors/index.d.ts +7 -0
- package/dist/httpInterceptors/index.d.ts.map +1 -0
- package/dist/httpInterceptors/index.js +7 -0
- package/dist/httpInterceptors/index.js.map +1 -0
- package/dist/httpInterceptors/manager/httpInterceptor.lookup.d.ts.map +1 -0
- package/dist/httpInterceptors/manager/httpInterceptor.manager.d.ts.map +1 -0
- package/dist/httpInterceptors/manager/httpInterceptor.registration.d.ts.map +1 -0
- package/dist/httpInterceptors/manager/httpInterceptor.snapshot.d.ts.map +1 -0
- package/dist/httpInterceptors/manager/index.d.ts.map +1 -0
- package/dist/httpKeepAlive/httpKeepAlive.core.d.ts.map +1 -0
- package/dist/httpKeepAlive/index.d.ts +7 -0
- package/dist/httpKeepAlive/index.d.ts.map +1 -0
- package/dist/httpKeepAlive/index.js +7 -0
- package/dist/httpKeepAlive/index.js.map +1 -0
- package/dist/httpMethods/http.methods.d.ts.map +1 -0
- package/dist/httpMethods/index.d.ts +7 -0
- package/dist/httpMethods/index.d.ts.map +1 -0
- package/dist/httpMethods/index.js +7 -0
- package/dist/httpMethods/index.js.map +1 -0
- package/dist/httpMiddleware/builtin/compose/httpMiddleware.compose.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/compose/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/conditional/httpMiddleware.conditional.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/conditional/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/cors/httpMiddleware.cors.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/cors/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/helpers/httpMiddleware.accessor.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/helpers/httpMiddleware.accessor.js +52 -0
- package/dist/httpMiddleware/builtin/helpers/httpMiddleware.accessor.js.map +1 -0
- package/dist/httpMiddleware/builtin/helpers/httpMiddleware.contextHelper.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/helpers/httpMiddleware.normalizer.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/helpers/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/image/httpMiddleware.image.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/image/index.d.ts +7 -0
- package/dist/httpMiddleware/builtin/image/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/image/index.js +7 -0
- package/dist/httpMiddleware/builtin/image/index.js.map +1 -0
- package/dist/httpMiddleware/builtin/index.d.ts +18 -0
- package/dist/httpMiddleware/builtin/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/index.js +22 -0
- package/dist/httpMiddleware/builtin/index.js.map +1 -0
- package/dist/httpMiddleware/builtin/logging/httpMiddleware.logging.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/logging/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/security/httpMiddleware.security.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/security/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/static/httpMiddleware.static.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/static/index.d.ts +7 -0
- package/dist/httpMiddleware/builtin/static/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/static/index.js +7 -0
- package/dist/httpMiddleware/builtin/static/index.js.map +1 -0
- package/dist/httpMiddleware/builtin/timing/httpMiddleware.timing.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/timing/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/video/httpMiddleware.video.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/video/index.d.ts +7 -0
- package/dist/httpMiddleware/builtin/video/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/video/index.js +7 -0
- package/dist/httpMiddleware/builtin/video/index.js.map +1 -0
- package/dist/httpMiddleware/httpMiddleware.error.d.ts +38 -0
- package/dist/httpMiddleware/httpMiddleware.error.d.ts.map +1 -0
- package/dist/httpMiddleware/httpMiddleware.error.js +60 -0
- package/dist/httpMiddleware/httpMiddleware.error.js.map +1 -0
- package/dist/httpMiddleware/httpMiddleware.state.d.ts.map +1 -0
- package/dist/httpMiddleware/httpMiddleware.type.d.ts.map +1 -0
- package/dist/httpMiddleware/index.d.ts +11 -0
- package/dist/httpMiddleware/index.d.ts.map +1 -0
- package/dist/httpMiddleware/index.js +11 -0
- package/dist/httpMiddleware/index.js.map +1 -0
- package/dist/httpMiddleware/pipeline/httpMiddleware.pipeline.d.ts.map +1 -0
- package/dist/httpMiddleware/pipeline/httpPipeline.execution.d.ts.map +1 -0
- package/dist/httpMiddleware/pipeline/httpPipeline.helper.d.ts.map +1 -0
- package/dist/httpMiddleware/pipeline/httpPipeline.registration.d.ts.map +1 -0
- package/dist/httpMiddleware/pipeline/index.d.ts +10 -0
- package/dist/httpMiddleware/pipeline/index.d.ts.map +1 -0
- package/dist/httpMiddleware/pipeline/index.js +10 -0
- package/dist/httpMiddleware/pipeline/index.js.map +1 -0
- package/dist/httpMime/http.mime.d.ts.map +1 -0
- package/dist/httpMime/index.d.ts +7 -0
- package/dist/httpMime/index.d.ts.map +1 -0
- package/dist/httpMime/index.js +7 -0
- package/dist/httpMime/index.js.map +1 -0
- package/dist/httpMultipart/http.multipart.d.ts +42 -0
- package/dist/httpMultipart/http.multipart.d.ts.map +1 -0
- package/dist/httpMultipart/http.multipart.js +334 -0
- package/dist/httpMultipart/http.multipart.js.map +1 -0
- package/dist/httpMultipart/index.d.ts +7 -0
- package/dist/httpMultipart/index.d.ts.map +1 -0
- package/dist/httpMultipart/index.js +7 -0
- package/dist/httpMultipart/index.js.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.accept.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.charset.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.construction.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.core.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.encoding.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.formatting.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.helpers.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.internal.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.language.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.mediaType.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.negotiate.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.parsing.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.quality.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.sorting.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.types.d.ts.map +1 -0
- package/dist/httpNegotiation/index.d.ts +7 -0
- package/dist/httpNegotiation/index.d.ts.map +1 -0
- package/dist/httpNegotiation/index.js +7 -0
- package/dist/httpNegotiation/index.js.map +1 -0
- package/dist/httpProtocol/http.protocol.d.ts.map +1 -0
- package/dist/httpProtocol/index.d.ts +7 -0
- package/dist/httpProtocol/index.d.ts.map +1 -0
- package/dist/httpProtocol/index.js +7 -0
- package/dist/httpProtocol/index.js.map +1 -0
- package/dist/httpProxy/http.proxy.d.ts.map +1 -0
- package/dist/httpProxy/index.d.ts +8 -0
- package/dist/httpProxy/index.d.ts.map +1 -0
- package/dist/httpProxy/index.js +8 -0
- package/dist/httpProxy/index.js.map +1 -0
- package/dist/httpQuery/http.query.d.ts.map +1 -0
- package/dist/httpQuery/httpQuery.string.d.ts.map +1 -0
- package/dist/httpQuery/index.d.ts +8 -0
- package/dist/httpQuery/index.d.ts.map +1 -0
- package/dist/httpQuery/index.js +8 -0
- package/dist/httpQuery/index.js.map +1 -0
- package/dist/httpRange/http.range.d.ts.map +1 -0
- package/dist/httpRange/index.d.ts +7 -0
- package/dist/httpRange/index.d.ts.map +1 -0
- package/dist/httpRange/index.js +7 -0
- package/dist/httpRange/index.js.map +1 -0
- package/dist/httpRedirect/http.redirect.d.ts.map +1 -0
- package/dist/httpRedirect/index.d.ts +7 -0
- package/dist/httpRedirect/index.d.ts.map +1 -0
- package/dist/httpRedirect/index.js +7 -0
- package/dist/httpRedirect/index.js.map +1 -0
- package/dist/httpRequest/http.request.d.ts.map +1 -0
- package/dist/httpRequest/httpRequest.context.constant.d.ts.map +1 -0
- package/dist/httpRequest/httpRequest.context.constant.js +8 -0
- package/dist/httpRequest/httpRequest.context.constant.js.map +1 -0
- package/dist/httpRequest/httpRequest.context.d.ts.map +1 -0
- package/dist/httpRequest/httpRequest.context.id.d.ts.map +1 -0
- package/dist/httpRequest/httpRequest.context.js +402 -0
- package/dist/httpRequest/httpRequest.context.js.map +1 -0
- package/dist/httpRequest/httpRequest.context.type.d.ts.map +1 -0
- package/dist/httpRequest/index.d.ts +8 -0
- package/dist/httpRequest/index.d.ts.map +1 -0
- package/dist/httpRequest/index.js +8 -0
- package/dist/httpRequest/index.js.map +1 -0
- package/dist/httpResponse/core/httpResponse.statusText.d.ts.map +1 -0
- package/dist/httpResponse/core/httpResponse.type.d.ts.map +1 -0
- package/dist/httpResponse/core/index.d.ts.map +1 -0
- package/dist/httpResponse/http.response.d.ts.map +1 -0
- package/dist/httpResponse/httpResponse.context.d.ts.map +1 -0
- package/dist/httpResponse/httpResponse.helper.d.ts.map +1 -0
- package/dist/httpResponse/httpResponse.writer.d.ts +52 -0
- package/dist/httpResponse/httpResponse.writer.d.ts.map +1 -0
- package/dist/httpResponse/httpResponse.writer.js +278 -0
- package/dist/httpResponse/httpResponse.writer.js.map +1 -0
- package/dist/httpResponse/index.d.ts +9 -0
- package/dist/httpResponse/index.d.ts.map +1 -0
- package/dist/httpResponse/index.js +9 -0
- package/dist/httpResponse/index.js.map +1 -0
- package/dist/httpSecurity/httpSecurity.config.d.ts +43 -0
- package/dist/httpSecurity/httpSecurity.config.d.ts.map +1 -0
- package/dist/httpSecurity/httpSecurity.config.js +26 -0
- package/dist/httpSecurity/httpSecurity.config.js.map +1 -0
- package/dist/httpSecurity/httpSecurity.guard.d.ts +29 -0
- package/dist/httpSecurity/httpSecurity.guard.d.ts.map +1 -0
- package/dist/httpSecurity/httpSecurity.guard.js +40 -0
- package/dist/httpSecurity/httpSecurity.guard.js.map +1 -0
- package/dist/httpSecurity/httpSecurity.validator.d.ts +42 -0
- package/dist/httpSecurity/httpSecurity.validator.d.ts.map +1 -0
- package/dist/httpSecurity/httpSecurity.validator.js +151 -0
- package/dist/httpSecurity/httpSecurity.validator.js.map +1 -0
- package/dist/httpSecurity/index.d.ts +14 -0
- package/dist/httpSecurity/index.d.ts.map +1 -0
- package/dist/httpSecurity/index.js +11 -0
- package/dist/httpSecurity/index.js.map +1 -0
- package/dist/httpSecurityHeaders/core/httpSecurityHeader.type.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/core/httpSecurityHeader.validation.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/core/index.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/httpSecurity.headers.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/httpSecurityHeader.factory.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/httpSecurityHeader.individual.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/httpSecurityHeader.permissionsPolicy.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/httpSecurityHeader.recommended.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/index.d.ts +7 -0
- package/dist/httpSecurityHeaders/index.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/index.js +7 -0
- package/dist/httpSecurityHeaders/index.js.map +1 -0
- package/dist/httpServer/core/httpServer.core.d.ts +55 -0
- package/dist/httpServer/core/httpServer.core.d.ts.map +1 -0
- package/dist/httpServer/core/httpServer.core.js +240 -0
- package/dist/httpServer/core/httpServer.core.js.map +1 -0
- package/dist/httpServer/core/index.d.ts +7 -0
- package/dist/httpServer/core/index.d.ts.map +1 -0
- package/dist/httpServer/core/index.js +7 -0
- package/dist/httpServer/core/index.js.map +1 -0
- package/dist/httpServer/factory/httpServer.factory.d.ts +24 -0
- package/dist/httpServer/factory/httpServer.factory.d.ts.map +1 -0
- package/dist/httpServer/factory/httpServer.factory.js +67 -0
- package/dist/httpServer/factory/httpServer.factory.js.map +1 -0
- package/dist/httpServer/factory/index.d.ts +7 -0
- package/dist/httpServer/factory/index.d.ts.map +1 -0
- package/dist/httpServer/factory/index.js +7 -0
- package/dist/httpServer/factory/index.js.map +1 -0
- package/dist/httpServer/index.d.ts +10 -0
- package/dist/httpServer/index.d.ts.map +1 -0
- package/dist/httpServer/index.js +10 -0
- package/dist/httpServer/index.js.map +1 -0
- package/dist/httpServer/manager/httpServer.manager.d.ts +19 -0
- package/dist/httpServer/manager/httpServer.manager.d.ts.map +1 -0
- package/dist/httpServer/manager/httpServer.manager.js +57 -0
- package/dist/httpServer/manager/httpServer.manager.js.map +1 -0
- package/dist/httpServer/manager/index.d.ts +7 -0
- package/dist/httpServer/manager/index.d.ts.map +1 -0
- package/dist/httpServer/manager/index.js +7 -0
- package/dist/httpServer/manager/index.js.map +1 -0
- package/dist/httpServer/types/httpServer.type.d.ts +43 -0
- package/dist/httpServer/types/httpServer.type.d.ts.map +1 -0
- package/dist/httpServer/types/httpServer.type.js +8 -0
- package/dist/httpServer/types/httpServer.type.js.map +1 -0
- package/dist/httpStatus/httpStatus.categoryPredicate.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.clientErrorConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.clientErrorTextConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.collection.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.commonPredicate.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.constant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.errorPredicate.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.info.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.informationalSuccessConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.informationalSuccessTextConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.lookup.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.name.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.predicate.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.redirectErrorConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.redirectErrorTextConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.redirectPredicate.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.redirectionConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.redirectionTextConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.semantics.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.serverErrorConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.serverErrorTextConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.statusConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.statusTextConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.type.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.validator.d.ts.map +1 -0
- package/dist/httpStatus/httpStatusCodes.constant.d.ts.map +1 -0
- package/dist/httpStatus/index.d.ts +20 -0
- package/dist/httpStatus/index.d.ts.map +1 -0
- package/dist/httpStatus/index.js +20 -0
- package/dist/httpStatus/index.js.map +1 -0
- package/dist/httpStream/httpStream.backpressure.d.ts +6 -0
- package/dist/httpStream/httpStream.backpressure.d.ts.map +1 -0
- package/dist/httpStream/httpStream.backpressure.js +38 -0
- package/dist/httpStream/httpStream.backpressure.js.map +1 -0
- package/dist/httpStream/httpStream.constants.d.ts +5 -0
- package/dist/httpStream/httpStream.constants.d.ts.map +1 -0
- package/dist/httpStream/httpStream.constants.js +5 -0
- package/dist/httpStream/httpStream.constants.js.map +1 -0
- package/dist/httpStream/httpStream.consume.d.ts +6 -0
- package/dist/httpStream/httpStream.consume.d.ts.map +1 -0
- package/dist/httpStream/httpStream.consume.js +70 -0
- package/dist/httpStream/httpStream.consume.js.map +1 -0
- package/dist/httpStream/httpStream.destroy.d.ts +5 -0
- package/dist/httpStream/httpStream.destroy.d.ts.map +1 -0
- package/dist/httpStream/httpStream.destroy.js +11 -0
- package/dist/httpStream/httpStream.destroy.js.map +1 -0
- package/dist/httpStream/httpStream.error.d.ts +8 -0
- package/dist/httpStream/httpStream.error.d.ts.map +1 -0
- package/dist/httpStream/httpStream.error.js +17 -0
- package/dist/httpStream/httpStream.error.js.map +1 -0
- package/dist/httpStream/httpStream.eventHelper.d.ts +13 -0
- package/dist/httpStream/httpStream.eventHelper.d.ts.map +1 -0
- package/dist/httpStream/httpStream.eventHelper.js +50 -0
- package/dist/httpStream/httpStream.eventHelper.js.map +1 -0
- package/dist/httpStream/httpStream.helper.d.ts +8 -0
- package/dist/httpStream/httpStream.helper.d.ts.map +1 -0
- package/dist/httpStream/httpStream.helper.js +35 -0
- package/dist/httpStream/httpStream.helper.js.map +1 -0
- package/dist/httpStream/httpStream.pipe.d.ts +7 -0
- package/dist/httpStream/httpStream.pipe.d.ts.map +1 -0
- package/dist/httpStream/httpStream.pipe.js +107 -0
- package/dist/httpStream/httpStream.pipe.js.map +1 -0
- package/dist/httpStream/httpStream.progress.d.ts +6 -0
- package/dist/httpStream/httpStream.progress.d.ts.map +1 -0
- package/dist/httpStream/httpStream.progress.js +100 -0
- package/dist/httpStream/httpStream.progress.js.map +1 -0
- package/dist/httpStream/httpStream.read.d.ts +7 -0
- package/dist/httpStream/httpStream.read.d.ts.map +1 -0
- package/dist/httpStream/httpStream.read.js +20 -0
- package/dist/httpStream/httpStream.read.js.map +1 -0
- package/dist/httpStream/httpStream.request.d.ts +8 -0
- package/dist/httpStream/httpStream.request.d.ts.map +1 -0
- package/dist/httpStream/httpStream.request.js +11 -0
- package/dist/httpStream/httpStream.request.js.map +1 -0
- package/dist/httpStream/httpStream.state.d.ts +8 -0
- package/dist/httpStream/httpStream.state.d.ts.map +1 -0
- package/dist/httpStream/httpStream.state.js +17 -0
- package/dist/httpStream/httpStream.state.js.map +1 -0
- package/dist/httpStream/httpStream.transform.d.ts +8 -0
- package/dist/httpStream/httpStream.transform.d.ts.map +1 -0
- package/dist/httpStream/httpStream.transform.js +17 -0
- package/dist/httpStream/httpStream.transform.js.map +1 -0
- package/dist/httpStream/httpStream.types.d.ts +19 -0
- package/dist/httpStream/httpStream.types.d.ts.map +1 -0
- package/dist/httpStream/httpStream.types.js +5 -0
- package/dist/httpStream/httpStream.types.js.map +1 -0
- package/dist/httpStream/index.d.ts +20 -0
- package/dist/httpStream/index.d.ts.map +1 -0
- package/dist/httpStream/index.js +20 -0
- package/dist/httpStream/index.js.map +1 -0
- package/dist/httpTrustProxy/httpTrustProxy.compilation.d.ts.map +1 -0
- package/dist/httpTrustProxy/httpTrustProxy.core.d.ts.map +1 -0
- package/dist/httpTrustProxy/httpTrustProxy.helper.d.ts.map +1 -0
- package/dist/httpTrustProxy/httpTrustProxy.parsing.d.ts.map +1 -0
- package/dist/httpTrustProxy/httpTrustProxy.type.d.ts.map +1 -0
- package/dist/httpTrustProxy/index.d.ts +7 -0
- package/dist/httpTrustProxy/index.d.ts.map +1 -0
- package/dist/httpTrustProxy/index.js +7 -0
- package/dist/httpTrustProxy/index.js.map +1 -0
- package/dist/httpTypes/http.types.d.ts +212 -0
- package/dist/httpTypes/http.types.d.ts.map +1 -0
- package/dist/httpTypes/http.types.js +15 -0
- package/dist/httpTypes/http.types.js.map +1 -0
- package/dist/httpTypes/index.d.ts +7 -0
- package/dist/httpTypes/index.d.ts.map +1 -0
- package/dist/httpTypes/index.js +7 -0
- package/dist/httpTypes/index.js.map +1 -0
- package/dist/httpUrl/http.url.d.ts.map +1 -0
- package/dist/httpUrl/index.d.ts +7 -0
- package/dist/httpUrl/index.d.ts.map +1 -0
- package/dist/httpUrl/index.js +7 -0
- package/dist/httpUrl/index.js.map +1 -0
- package/dist/httpValidation/httpValidationAssertion.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationAuthority.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationAuthorization.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationCacheControl.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationContentLength.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationContentType.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationCookie.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationDate.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationETag.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationHeader.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationHostname.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationMessage.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationMethod.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationPort.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationRange.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationRequestTarget.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationStatusCode.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationToken.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationTypes.type.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationUrl.d.ts.map +1 -0
- package/dist/httpValidation/index.d.ts +29 -0
- package/dist/httpValidation/index.d.ts.map +1 -0
- package/dist/httpValidation/index.js +29 -0
- package/dist/httpValidation/index.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { IncomingMessage } from "node:http";
|
|
2
|
+
export interface HTTPFormDataFile {
|
|
3
|
+
readonly fieldName: string;
|
|
4
|
+
readonly filename: string;
|
|
5
|
+
readonly contentType: string;
|
|
6
|
+
readonly size: number;
|
|
7
|
+
readonly data: Buffer;
|
|
8
|
+
}
|
|
9
|
+
export interface HTTPFormDataField {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly value: string;
|
|
12
|
+
}
|
|
13
|
+
export type HTTPFormDataValue = string | HTTPFormDataFile;
|
|
14
|
+
export interface HTTPFormData {
|
|
15
|
+
readonly fields: ReadonlyMap<string, HTTPFormDataValue[]>;
|
|
16
|
+
readonly fieldNames: readonly string[];
|
|
17
|
+
get(name: string): HTTPFormDataValue | undefined;
|
|
18
|
+
getAll(name: string): readonly HTTPFormDataValue[];
|
|
19
|
+
has(name: string): boolean;
|
|
20
|
+
entries(): IterableIterator<readonly [string, HTTPFormDataValue]>;
|
|
21
|
+
keys(): IterableIterator<string>;
|
|
22
|
+
values(): IterableIterator<HTTPFormDataValue>;
|
|
23
|
+
forEach(callback: (value: HTTPFormDataValue, name: string) => void): void;
|
|
24
|
+
toObject(): Record<string, HTTPFormDataValue | HTTPFormDataValue[]>;
|
|
25
|
+
}
|
|
26
|
+
export interface HTTPFormDataParseOptions {
|
|
27
|
+
readonly request: IncomingMessage;
|
|
28
|
+
readonly limit?: number;
|
|
29
|
+
readonly maxFields?: number;
|
|
30
|
+
readonly maxFieldSize?: number;
|
|
31
|
+
readonly maxFileSize?: number;
|
|
32
|
+
readonly maxFiles?: number;
|
|
33
|
+
readonly strict?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare const DEFAULT_FORM_DATA_LIMIT: number;
|
|
36
|
+
export declare const DEFAULT_MAX_FIELDS = 1000;
|
|
37
|
+
export declare const DEFAULT_MAX_FIELD_SIZE: number;
|
|
38
|
+
export declare const DEFAULT_MAX_FILE_SIZE: number;
|
|
39
|
+
export declare const DEFAULT_MAX_FILES = 100;
|
|
40
|
+
export declare function isMultipartContentType(contentType: string | undefined): boolean;
|
|
41
|
+
export declare function getMultipartBoundary(contentType: string | undefined): string | undefined;
|
|
42
|
+
export declare function parseFormData(options: HTTPFormDataParseOptions): Promise<HTTPFormData>;
|
|
43
|
+
export declare function parseMultipartBody(body: Buffer, boundary: string, options: Omit<HTTPFormDataParseOptions, "request" | "limit">): HTTPFormData;
|
|
44
|
+
export declare function sanitizeFilename(filename: string): string;
|
|
45
|
+
import { HttpFormDataError as HTTPFormDataError, HttpFormDataLimitError as HTTPFormDataLimitError, HttpFormDataParseError as HTTPFormDataParseError } from "@zudojs/errors";
|
|
46
|
+
export { HTTPFormDataError, HTTPFormDataLimitError, HTTPFormDataParseError };
|
|
47
|
+
export declare function createFormData(): HTTPFormData;
|
|
48
|
+
//# sourceMappingURL=httpBody.formData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpBody.formData.d.ts","sourceRoot":"","sources":["../../src/httpBody/httpBody.formData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAOjD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,gBAAgB,CAAC;AAE1D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAE1D,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAEvC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;IAEjD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,iBAAiB,EAAE,CAAC;IAEnD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAE3B,OAAO,IAAI,gBAAgB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,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,SAAS,GAAG,OAAO,CAAC,GAC3D,YAAY,CAyId;AA8ND,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIzD;AAgDD,OAAO,EACL,iBAAiB,IAAI,iBAAiB,EACtC,sBAAsB,IAAI,sBAAsB,EAChD,sBAAsB,IAAI,sBAAsB,EACjD,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,CAAC;AAM7E,wBAAgB,cAAc,IAAI,YAAY,CAE7C"}
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { readBody } from "./http.body.js";
|
|
2
|
+
/* -------------------------------------------------------------------------- */
|
|
3
|
+
/* Defaults */
|
|
4
|
+
/* -------------------------------------------------------------------------- */
|
|
5
|
+
export const DEFAULT_FORM_DATA_LIMIT = 10 * 1024 * 1024;
|
|
6
|
+
export const DEFAULT_MAX_FIELDS = 1000;
|
|
7
|
+
export const DEFAULT_MAX_FIELD_SIZE = 1024 * 1024;
|
|
8
|
+
export const DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
9
|
+
export const DEFAULT_MAX_FILES = 100;
|
|
10
|
+
/* -------------------------------------------------------------------------- */
|
|
11
|
+
/* Content Type */
|
|
12
|
+
/* -------------------------------------------------------------------------- */
|
|
13
|
+
export function isMultipartContentType(contentType) {
|
|
14
|
+
if (!contentType) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
return (contentType.split(";", 1)[0]?.trim().toLowerCase() === "multipart/form-data");
|
|
18
|
+
}
|
|
19
|
+
export function getMultipartBoundary(contentType) {
|
|
20
|
+
if (!contentType) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
const parts = contentType.split(";");
|
|
24
|
+
if (parts[0]?.trim().toLowerCase() !== "multipart/form-data") {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
for (const part of parts.slice(1)) {
|
|
28
|
+
const index = part.indexOf("=");
|
|
29
|
+
if (index === -1) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const key = part.slice(0, index).trim().toLowerCase();
|
|
33
|
+
if (key !== "boundary") {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
let boundary = part.slice(index + 1).trim();
|
|
37
|
+
if (boundary.length >= 2 &&
|
|
38
|
+
boundary.startsWith('"') &&
|
|
39
|
+
boundary.endsWith('"')) {
|
|
40
|
+
boundary = boundary.slice(1, -1);
|
|
41
|
+
}
|
|
42
|
+
if (boundary.length === 0) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
return boundary;
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
/* -------------------------------------------------------------------------- */
|
|
50
|
+
/* Parser */
|
|
51
|
+
/* -------------------------------------------------------------------------- */
|
|
52
|
+
export async function parseFormData(options) {
|
|
53
|
+
const { request, limit = DEFAULT_FORM_DATA_LIMIT, maxFields = DEFAULT_MAX_FIELDS, maxFieldSize = DEFAULT_MAX_FIELD_SIZE, maxFileSize = DEFAULT_MAX_FILE_SIZE, maxFiles = DEFAULT_MAX_FILES, strict = true, } = options;
|
|
54
|
+
validateLimit(limit, "Form-data");
|
|
55
|
+
validateLimit(maxFields, "Maximum field count");
|
|
56
|
+
validateLimit(maxFieldSize, "Maximum field size");
|
|
57
|
+
validateLimit(maxFileSize, "Maximum file size");
|
|
58
|
+
validateLimit(maxFiles, "Maximum file count");
|
|
59
|
+
const contentType = request.headers["content-type"];
|
|
60
|
+
const normalizedContentType = Array.isArray(contentType)
|
|
61
|
+
? contentType[0]
|
|
62
|
+
: contentType;
|
|
63
|
+
const boundary = getMultipartBoundary(normalizedContentType);
|
|
64
|
+
if (!boundary) {
|
|
65
|
+
throw new HTTPFormDataParseError("Multipart boundary is missing or invalid.");
|
|
66
|
+
}
|
|
67
|
+
if (boundary.length > 200) {
|
|
68
|
+
throw new HTTPFormDataParseError("Multipart boundary is too long.");
|
|
69
|
+
}
|
|
70
|
+
const body = await readBody({
|
|
71
|
+
request,
|
|
72
|
+
limit,
|
|
73
|
+
});
|
|
74
|
+
return parseMultipartBody(body, boundary, {
|
|
75
|
+
maxFields,
|
|
76
|
+
maxFieldSize,
|
|
77
|
+
maxFileSize,
|
|
78
|
+
maxFiles,
|
|
79
|
+
strict,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/* -------------------------------------------------------------------------- */
|
|
83
|
+
/* Multipart Parser */
|
|
84
|
+
/* -------------------------------------------------------------------------- */
|
|
85
|
+
export function parseMultipartBody(body, boundary, options) {
|
|
86
|
+
const { maxFields = DEFAULT_MAX_FIELDS, maxFieldSize = DEFAULT_MAX_FIELD_SIZE, maxFileSize = DEFAULT_MAX_FILE_SIZE, maxFiles = DEFAULT_MAX_FILES, strict = true, } = options;
|
|
87
|
+
const boundaryBuffer = Buffer.from(`--${boundary}`, "utf8");
|
|
88
|
+
const result = new HTTPFormDataImpl();
|
|
89
|
+
let position = 0;
|
|
90
|
+
let fieldCount = 0;
|
|
91
|
+
let fileCount = 0;
|
|
92
|
+
if (!body.subarray(0, boundaryBuffer.length).equals(boundaryBuffer)) {
|
|
93
|
+
throw new HTTPFormDataParseError("Invalid multipart body.");
|
|
94
|
+
}
|
|
95
|
+
position = boundaryBuffer.length;
|
|
96
|
+
while (position < body.length) {
|
|
97
|
+
if (body[position] === 45 && body[position + 1] === 45) {
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
if (body[position] === 13 && body[position + 1] === 10) {
|
|
101
|
+
position += 2;
|
|
102
|
+
}
|
|
103
|
+
else if (strict) {
|
|
104
|
+
throw new HTTPFormDataParseError("Invalid multipart boundary separator.");
|
|
105
|
+
}
|
|
106
|
+
const nextBoundary = findBoundary(body, boundaryBuffer, position);
|
|
107
|
+
if (nextBoundary === -1) {
|
|
108
|
+
throw new HTTPFormDataParseError("Multipart closing boundary was not found.");
|
|
109
|
+
}
|
|
110
|
+
const partEnd = nextBoundary;
|
|
111
|
+
const headerEnd = findHeaderEnd(body, position, partEnd);
|
|
112
|
+
if (headerEnd === -1) {
|
|
113
|
+
throw new HTTPFormDataParseError("Multipart part headers are invalid.");
|
|
114
|
+
}
|
|
115
|
+
const headerBuffer = body.subarray(position, headerEnd);
|
|
116
|
+
const headers = parsePartHeaders(headerBuffer);
|
|
117
|
+
const disposition = headers.get("content-disposition");
|
|
118
|
+
if (!disposition) {
|
|
119
|
+
if (strict) {
|
|
120
|
+
throw new HTTPFormDataParseError("Multipart part is missing Content-Disposition.");
|
|
121
|
+
}
|
|
122
|
+
position = nextBoundary + boundaryBuffer.length;
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
const metadata = parseContentDisposition(disposition);
|
|
126
|
+
if (!metadata.name) {
|
|
127
|
+
if (strict) {
|
|
128
|
+
throw new HTTPFormDataParseError("Multipart part is missing a field name.");
|
|
129
|
+
}
|
|
130
|
+
position = nextBoundary + boundaryBuffer.length;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const dataStart = headerEnd + 4;
|
|
134
|
+
const dataEnd = partEnd;
|
|
135
|
+
const data = body.subarray(dataStart, dataEnd);
|
|
136
|
+
if (metadata.filename !== undefined) {
|
|
137
|
+
fileCount += 1;
|
|
138
|
+
if (fileCount > maxFiles) {
|
|
139
|
+
throw new HTTPFormDataLimitError("Maximum file count exceeded.");
|
|
140
|
+
}
|
|
141
|
+
if (data.length > maxFileSize) {
|
|
142
|
+
throw new HTTPFormDataLimitError("Multipart file exceeds the configured size limit.");
|
|
143
|
+
}
|
|
144
|
+
const filename = sanitizeFilename(metadata.filename);
|
|
145
|
+
const contentType = headers.get("content-type") ?? "application/octet-stream";
|
|
146
|
+
result.append(metadata.name, {
|
|
147
|
+
fieldName: metadata.name,
|
|
148
|
+
filename,
|
|
149
|
+
contentType,
|
|
150
|
+
size: data.length,
|
|
151
|
+
data: Buffer.from(data),
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
fieldCount += 1;
|
|
156
|
+
if (fieldCount > maxFields) {
|
|
157
|
+
throw new HTTPFormDataLimitError("Maximum field count exceeded.");
|
|
158
|
+
}
|
|
159
|
+
if (data.length > maxFieldSize) {
|
|
160
|
+
throw new HTTPFormDataLimitError("Multipart field exceeds the configured size limit.");
|
|
161
|
+
}
|
|
162
|
+
const charset = getCharset(headers.get("content-type"));
|
|
163
|
+
result.append(metadata.name, data.toString(charset));
|
|
164
|
+
}
|
|
165
|
+
position = nextBoundary + boundaryBuffer.length;
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
/* -------------------------------------------------------------------------- */
|
|
170
|
+
/* HTTPFormData Implementation */
|
|
171
|
+
/* -------------------------------------------------------------------------- */
|
|
172
|
+
class HTTPFormDataImpl {
|
|
173
|
+
data = new Map();
|
|
174
|
+
get fields() {
|
|
175
|
+
return this.data;
|
|
176
|
+
}
|
|
177
|
+
get fieldNames() {
|
|
178
|
+
return Array.from(this.data.keys());
|
|
179
|
+
}
|
|
180
|
+
get(name) {
|
|
181
|
+
return this.data.get(name)?.[0];
|
|
182
|
+
}
|
|
183
|
+
getAll(name) {
|
|
184
|
+
return this.data.get(name) ?? [];
|
|
185
|
+
}
|
|
186
|
+
has(name) {
|
|
187
|
+
return this.data.has(name);
|
|
188
|
+
}
|
|
189
|
+
entries() {
|
|
190
|
+
return this.entryIterator();
|
|
191
|
+
}
|
|
192
|
+
keys() {
|
|
193
|
+
return this.keyIterator();
|
|
194
|
+
}
|
|
195
|
+
values() {
|
|
196
|
+
return this.valueIterator();
|
|
197
|
+
}
|
|
198
|
+
forEach(callback) {
|
|
199
|
+
for (const [name, values] of this.data) {
|
|
200
|
+
for (const value of values) {
|
|
201
|
+
callback(value, name);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
toObject() {
|
|
206
|
+
const result = {};
|
|
207
|
+
for (const [name, values] of this.data) {
|
|
208
|
+
result[name] = values.length === 1 ? values[0] : [...values];
|
|
209
|
+
}
|
|
210
|
+
return result;
|
|
211
|
+
}
|
|
212
|
+
append(name, value) {
|
|
213
|
+
const existing = this.data.get(name);
|
|
214
|
+
if (existing) {
|
|
215
|
+
existing.push(value);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
this.data.set(name, [value]);
|
|
219
|
+
}
|
|
220
|
+
*entryIterator() {
|
|
221
|
+
for (const [name, values] of this.data) {
|
|
222
|
+
for (const value of values) {
|
|
223
|
+
yield [name, value];
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
*keyIterator() {
|
|
228
|
+
for (const [name, values] of this.data) {
|
|
229
|
+
for (let index = 0; index < values.length; index += 1) {
|
|
230
|
+
yield name;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
*valueIterator() {
|
|
235
|
+
for (const values of this.data.values()) {
|
|
236
|
+
yield* values;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/* -------------------------------------------------------------------------- */
|
|
241
|
+
/* Headers */
|
|
242
|
+
/* -------------------------------------------------------------------------- */
|
|
243
|
+
function parsePartHeaders(input) {
|
|
244
|
+
const text = input.toString("latin1");
|
|
245
|
+
const result = new Map();
|
|
246
|
+
for (const line of text.split("\r\n")) {
|
|
247
|
+
const separator = line.indexOf(":");
|
|
248
|
+
if (separator <= 0) {
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
const name = line.slice(0, separator).trim().toLowerCase();
|
|
252
|
+
const value = line.slice(separator + 1).trim();
|
|
253
|
+
result.set(name, value);
|
|
254
|
+
}
|
|
255
|
+
return result;
|
|
256
|
+
}
|
|
257
|
+
function parseContentDisposition(value) {
|
|
258
|
+
const parts = value.split(";");
|
|
259
|
+
if (parts[0]?.trim().toLowerCase() !== "form-data") {
|
|
260
|
+
return {
|
|
261
|
+
name: undefined,
|
|
262
|
+
filename: undefined,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
let name;
|
|
266
|
+
let filename;
|
|
267
|
+
for (const part of parts.slice(1)) {
|
|
268
|
+
const separator = part.indexOf("=");
|
|
269
|
+
if (separator === -1) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
const key = part.slice(0, separator).trim().toLowerCase();
|
|
273
|
+
let parameter = part.slice(separator + 1).trim();
|
|
274
|
+
if (parameter.length >= 2 &&
|
|
275
|
+
parameter.startsWith('"') &&
|
|
276
|
+
parameter.endsWith('"')) {
|
|
277
|
+
parameter = parameter.slice(1, -1);
|
|
278
|
+
}
|
|
279
|
+
parameter = parameter.replace(/\\"/g, '"');
|
|
280
|
+
if (key === "name") {
|
|
281
|
+
name = parameter;
|
|
282
|
+
}
|
|
283
|
+
if (key === "filename") {
|
|
284
|
+
filename = parameter;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return {
|
|
288
|
+
name,
|
|
289
|
+
filename,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
/* -------------------------------------------------------------------------- */
|
|
293
|
+
/* Multipart Search */
|
|
294
|
+
/* -------------------------------------------------------------------------- */
|
|
295
|
+
function findBoundary(body, boundary, start) {
|
|
296
|
+
for (let index = start; index <= body.length - boundary.length; index += 1) {
|
|
297
|
+
if (body[index] !== 13 || body[index + 1] !== 10) {
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if (body.subarray(index + 2, index + 2 + boundary.length).equals(boundary)) {
|
|
301
|
+
return index;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return -1;
|
|
305
|
+
}
|
|
306
|
+
function findHeaderEnd(body, start, end) {
|
|
307
|
+
for (let index = start; index + 3 < end; index += 1) {
|
|
308
|
+
if (body[index] === 13 &&
|
|
309
|
+
body[index + 1] === 10 &&
|
|
310
|
+
body[index + 2] === 13 &&
|
|
311
|
+
body[index + 3] === 10) {
|
|
312
|
+
return index;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return -1;
|
|
316
|
+
}
|
|
317
|
+
/* -------------------------------------------------------------------------- */
|
|
318
|
+
/* Filename Security */
|
|
319
|
+
/* -------------------------------------------------------------------------- */
|
|
320
|
+
export function sanitizeFilename(filename) {
|
|
321
|
+
const normalized = filename.replace(/\\/g, "/").split("/").pop() ?? "";
|
|
322
|
+
return normalized.replace(/[\x00-\x1f\x7f]/g, "").trim();
|
|
323
|
+
}
|
|
324
|
+
/* -------------------------------------------------------------------------- */
|
|
325
|
+
/* Charset */
|
|
326
|
+
/* -------------------------------------------------------------------------- */
|
|
327
|
+
function getCharset(contentType) {
|
|
328
|
+
if (!contentType) {
|
|
329
|
+
return "utf8";
|
|
330
|
+
}
|
|
331
|
+
const match = /charset\s*=\s*"?([^;"\s]+)"?/i.exec(contentType);
|
|
332
|
+
if (!match?.[1]) {
|
|
333
|
+
return "utf8";
|
|
334
|
+
}
|
|
335
|
+
const charset = match[1].toLowerCase();
|
|
336
|
+
if (charset === "utf-8" || charset === "utf8") {
|
|
337
|
+
return "utf8";
|
|
338
|
+
}
|
|
339
|
+
if (charset === "ascii") {
|
|
340
|
+
return "ascii";
|
|
341
|
+
}
|
|
342
|
+
if (charset === "latin1" || charset === "iso-8859-1") {
|
|
343
|
+
return "latin1";
|
|
344
|
+
}
|
|
345
|
+
return "utf8";
|
|
346
|
+
}
|
|
347
|
+
/* -------------------------------------------------------------------------- */
|
|
348
|
+
/* Validation */
|
|
349
|
+
/* -------------------------------------------------------------------------- */
|
|
350
|
+
function validateLimit(value, label) {
|
|
351
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
352
|
+
throw new RangeError(`${label} must be a non-negative safe integer.`);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
/* -------------------------------------------------------------------------- */
|
|
356
|
+
/* Errors */
|
|
357
|
+
/* -------------------------------------------------------------------------- */
|
|
358
|
+
import { HttpFormDataError as HTTPFormDataError, HttpFormDataLimitError as HTTPFormDataLimitError, HttpFormDataParseError as HTTPFormDataParseError, } from "@zudojs/errors";
|
|
359
|
+
export { HTTPFormDataError, HTTPFormDataLimitError, HTTPFormDataParseError };
|
|
360
|
+
/* -------------------------------------------------------------------------- */
|
|
361
|
+
/* Factory */
|
|
362
|
+
/* -------------------------------------------------------------------------- */
|
|
363
|
+
export function createFormData() {
|
|
364
|
+
return new HTTPFormDataImpl();
|
|
365
|
+
}
|
|
366
|
+
//# sourceMappingURL=httpBody.formData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpBody.formData.js","sourceRoot":"","sources":["../../src/httpBody/httpBody.formData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA2D1C,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAExD,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,MAAM,UAAU,sBAAsB,CACpC,WAA+B;IAE/B,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,qBAAqB,CAC7E,CAAC;AAC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AAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAEvC,IAAI,OAAO,KAAK,OAAO,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QAC9C,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACxB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,YAAY,EAAE,CAAC;QACrD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,SAAS,aAAa,CAAC,KAAa,EAAE,KAAa;IACjD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,UAAU,CAAC,GAAG,KAAK,uCAAuC,CAAC,CAAC;IACxE,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,OAAO,EACL,iBAAiB,IAAI,iBAAiB,EACtC,sBAAsB,IAAI,sBAAsB,EAChD,sBAAsB,IAAI,sBAAsB,GACjD,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,CAAC;AAE7E,gFAAgF;AAChF,iFAAiF;AACjF,gFAAgF;AAEhF,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,gBAAgB,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { IncomingMessage } from "node:http";
|
|
2
|
+
import { parseBody, readBody, readForm, readJSON, readText, type HTTPBodyReaderOptions, type HTTPBodyParseOptions } from "./http.body.js";
|
|
3
|
+
import { type MultipartForm, type MultipartOptions } from "../httpMultipart/http.multipart.js";
|
|
4
|
+
export type ParsedBody = unknown | Buffer | string | Record<string, string | string[]> | MultipartForm;
|
|
5
|
+
export type BodyParserFormat = "json" | "form" | "text" | "multipart" | "raw";
|
|
6
|
+
export interface BodyParserOptions extends HTTPBodyParseOptions {
|
|
7
|
+
readonly multipart?: MultipartOptions;
|
|
8
|
+
readonly strictContentType?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface BodyParserResult<T = unknown> {
|
|
11
|
+
readonly body: T;
|
|
12
|
+
readonly format: BodyParserFormat;
|
|
13
|
+
readonly contentType?: string;
|
|
14
|
+
readonly contentLength?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface BodyParser {
|
|
17
|
+
parse<T = unknown>(request: IncomingMessage): Promise<BodyParserResult<T>>;
|
|
18
|
+
}
|
|
19
|
+
export declare const DEFAULT_BODY_PARSER_OPTIONS: Required<Pick<BodyParserOptions, "limit" | "encoding" | "strictContentType">>;
|
|
20
|
+
export declare function parseRequestBody<T = ParsedBody>(request: IncomingMessage, options?: BodyParserOptions): Promise<BodyParserResult<T>>;
|
|
21
|
+
export declare function detectBodyFormat(contentType: string | undefined): BodyParserFormat;
|
|
22
|
+
export declare function parseJSONBody<T = unknown>(request: IncomingMessage, options?: BodyParserOptions): Promise<T>;
|
|
23
|
+
export declare function parseFormBody(request: IncomingMessage, options?: BodyParserOptions): Promise<Record<string, string | string[]>>;
|
|
24
|
+
export declare function parseTextBody(request: IncomingMessage, options?: BodyParserOptions): Promise<string>;
|
|
25
|
+
export declare function parseRawBody(request: IncomingMessage, options?: BodyParserOptions): Promise<Buffer>;
|
|
26
|
+
export declare function parseMultipartBody(request: IncomingMessage, options?: BodyParserOptions): Promise<MultipartForm>;
|
|
27
|
+
export declare function createBodyParser(options?: BodyParserOptions): BodyParser;
|
|
28
|
+
export declare function hasRequestBody(request: IncomingMessage): boolean;
|
|
29
|
+
export declare function getRequestContentType(request: IncomingMessage): string | undefined;
|
|
30
|
+
export declare function getRequestContentLength(request: IncomingMessage): number | undefined;
|
|
31
|
+
export declare function isJSONRequest(request: IncomingMessage): boolean;
|
|
32
|
+
export declare function isFormRequest(request: IncomingMessage): boolean;
|
|
33
|
+
export declare function isMultipartRequestBody(request: IncomingMessage): boolean;
|
|
34
|
+
export declare function isTextRequest(request: IncomingMessage): boolean;
|
|
35
|
+
import { BodyParserError, UnsupportedBodyTypeError, InvalidContentLengthError } from "@zudojs/errors";
|
|
36
|
+
export { BodyParserError, UnsupportedBodyTypeError, InvalidContentLengthError };
|
|
37
|
+
export interface ParsedBodyRequest extends IncomingMessage {
|
|
38
|
+
body?: unknown;
|
|
39
|
+
}
|
|
40
|
+
export declare function attachParsedBody(request: ParsedBodyRequest, options?: BodyParserOptions): Promise<BodyParserResult>;
|
|
41
|
+
export declare function parseBodyWithOptions<T = unknown>(request: IncomingMessage, options?: BodyParserOptions): Promise<T>;
|
|
42
|
+
export { parseBody, readBody, readForm, readJSON, readText };
|
|
43
|
+
export type { HTTPBodyReaderOptions, HTTPBodyParseOptions };
|
|
44
|
+
//# sourceMappingURL=httpBody.parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpBody.parser.d.ts","sourceRoot":"","sources":["../../src/httpBody/httpBody.parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAOL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EAC1B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,oCAAoC,CAAC;AAM5C,MAAM,MAAM,UAAU,GACpB,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,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