anzharip/azure-function-multipart

Support of Azure Functions Node.js v4 programming model

laghamn opened this issue · 2 comments

We've been using this package successfully for our Azure Functions using v3 programming model (with function.json files).
When we started our migration to v4 programming model we discovered that the parsing of multipart form data fails due to Exception: Missing Content-Type, even if headers from the request are identical as before.

Whats seems have changed is that @azure/functions package use a different definition of HttpRequest in version 4.

At the moment we are using the following workaround, but it would be preferable with support in @anzp/azure-function-multipart package:

const headers = {}
for (const [key, value] of request.headers.entries()) {
  headers[key] = value
}

const { files, fields } = await parseMultipartFormData(
  { ...request, body: Buffer.from(await request.arrayBuffer()) },
  { headers }
)

Did you find any alternative?

Did you find any alternative?

No, still using that workaround above.