UNPKG

@azure-utils/storybooks

Version:

Utils to upload and manage Storybooks via Azure Functions and storage.

1 lines 1.2 kB
{"version":3,"file":"validators-C1FF8po_.mjs","names":["request: HttpRequest","context: InvocationContext"],"sources":["../src/utils/validators.ts"],"sourcesContent":["import type {\n HttpRequest,\n HttpResponseInit,\n InvocationContext,\n} from \"@azure/functions\";\nimport { responseError } from \"./response-utils\";\n\nexport function validateBuildUploadZipBody(\n request: HttpRequest,\n context: InvocationContext\n): HttpResponseInit | undefined {\n const body = request.body;\n if (!body) {\n return responseError(\"Request body is required\", context, 400);\n }\n const contentLength = request.headers.get(\"Content-Length\");\n if (!contentLength) {\n return responseError(\"Content-Length header is required\", context, 411);\n }\n if (parseInt(contentLength, 10) === 0) {\n return responseError(\"Request body should have length > 0\", context, 400);\n }\n\n return undefined;\n}\n"],"mappings":";;;AAOA,SAAgB,2BACdA,SACAC,SAC8B;CAC9B,MAAM,OAAO,QAAQ;AACrB,KAAI,CAAC,KACH,QAAO,cAAc,4BAA4B,SAAS,IAAI;CAEhE,MAAM,gBAAgB,QAAQ,QAAQ,IAAI,iBAAiB;AAC3D,KAAI,CAAC,cACH,QAAO,cAAc,qCAAqC,SAAS,IAAI;AAEzE,KAAI,SAAS,eAAe,GAAG,KAAK,EAClC,QAAO,cAAc,uCAAuC,SAAS,IAAI;AAG3E,QAAO;AACR"}