DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

How I can check that data is proper application/x-www-form-urlencoded data?

As I ask upon here:

I am trying to check if post data is a proper form www-urlencoded using nodejs:

const connect = require('connect')
const { request } = require('node:http');


const app = connect();

/**
 * Check if valis url encoded.
 * For now I set the value as true
 * @param {String} body 
 *

I try to check that request data are in a valid form as content-type application/x-www-form-urlencoded is expected to be.

I do not want to use any 3rd party libraries but to make a small middleware in order to do any checks.

Can u help me?

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More