anzharip / azure-function-multipart

Module to parse multipart/form-data on Azure Functions.
https://azure-function-multipart.stor.my.id
Apache License 2.0
17 stars 6 forks source link

Support of Azure Functions Node.js v4 programming model #637

Open laghamn opened 11 months ago

laghamn commented 11 months ago

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 }
)
LucasBonafe commented 1 month ago

Did you find any alternative?

laghamn commented 1 month ago

Did you find any alternative?

No, still using that workaround above.