博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
用postman测试url参数
阅读量:304 次
发布时间:2019-03-04

本文共 487 字,大约阅读时间需要 1 分钟。

const http = require('http');const querystring = require('querystring');http.createServer((req,res)=>{
if(req.url.startsWith('/login')){
let pdata = ''; req.on('data',(chunk)=>{
pdata += chunk; }); req.on('end',()=>{
let obj = querystring.parse(pdata); res.end(obj.id+' ---- '+obj.name); }) }}).listen(3000,()=>{
console.log('server is on!');})

postman测试时候要选x-www-form-urlencoded,不然会有其他信息出现

在这里插入图片描述

转载地址:http://ontq.baihongyu.com/

你可能感兴趣的文章