application/x-www-form-urlencoded

Browser HTML Form

        <form action="/justdata?id=x" method="post" enctype="application/x-www-form-urlencoded">
            <b>application/x-www-form-urlencoded</b><br>
            <span>jobid</span>
            <input type="number" name="jobid" value="0"><br>
            <span>jobname</span>
            <input type="text" name="jobname" value=""><br>
            <input type="submit"><br>
        </form>

Server Express Router

import express from "express";
import bodyParser from "body-parser";

const router = express.Router();

router.post("/justdata",
    log,
    bodyParser.urlencoded({ extended: true }),
    printBody
);

function log(req, res, next) {
    console.log(req.method + ` ` + req.originalUrl);
    next();
}

function printBody(req, res, next){
    console.log(req.body);
    console.log(req.query);
    next();
}

export default router;

Terminal Output

POST /justdata
{ jobid: '0', jobname: 'asdf' }
{ id: 'x' }

Request Headers

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: en-CA,en-GB;q=0.9,en-US;q=0.8,en;q=0.7
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 20
Content-Type: application/x-www-form-urlencoded

Request Body

jobid=0&jobname=asdf