DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on • Edited on

How I can verify that an incomming http body is multipart/form-data using regex and nodejs?

In my project I need to detect the content-type of http bodies ignoring the Content-Type header.

And I was stuck upon detecting multipart/form-data ones. After some tests, I used the regex in the question bellow:

At my nodejs project, I want to validate if an incoming http request is just a valid multipart/form-data one.

So far I tried the following example:

const http = require('http')
const validateMultipartFormData = (body) => {
   // Somehow use a logic to verify whether body is a multipart one.
   //

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more