【发布时间】:2019-10-20 13:11:14
【问题描述】:
我正在使用 Pug 制作我的第一个 JS Web 应用程序的最后一步,我需要测试它是否支持 POST 方法,该方法接受一个字符串应该返回一个 JSON 对象,其中包含 2 个代表原始的 key.value 对字符串及其长度。
我被指示使用 Postman 和 x-www-form-urlencoded 来测试我的应用程序,但我不知道如何使用 urlencoded 正文测试 POST 方法。
谁能告诉我应该在 Postman 的 x-www-form-urlencoded 下填写 KEY 和 VALUE 什么?
//POST method in route file
router.post('/', (req, res, next) => {
res.render('ps3post', {string: req.body.string, stringLength: req.body.string.length});
});
block content
h1 POST method, page rendered by PUG
p= string
p= stringLength
【问题讨论】: