UNPKG

fkc

Version:

FKC application service framework.

25 lines 720 B
'use strict'; const data = require('./data'); const {upload} = require('../util'); module.exports = (req,obj)=>{ const type = req.headers['content-type']; if(type==='application/json'){ if(obj.type==='json') { req.fkc.json = data(req,obj); } return; } if(type==='application/x-www-form-urlencoded'){ if(obj.type==='urlencoded') { req.fkc.urlencoded = data(req,obj); } return; } if(/^multipart\/form-data; boundary=(.*)/.test(type)) { if(obj.type==='upload'){ req.fkc.upload = upload(req,obj); } return; } if(obj.type==='raw') req.fkc.raw = data(req,obj); }