UNPKG

@incdevco/framework

Version:
32 lines (19 loc) 783 B
var Utilities = require('../../../utilities'); function Request(api, event) { 'use strict'; var self = this; event.params = event.params || {}; this.body = event.body; this.headers = event.params.header; this.method = event.httpMethod || event.method; this.originalPath = event.originalPath || event.path; this.path = event.path; this.params = Utilities.copy(event.params.path || {}); this.query = Utilities.copy(event.params.query || event.params.querystring || {}); Object.keys(this.params).forEach(function (key) { self.path = self.path.replace('\{'+key+'\}', self.params[key]); self.params[key] = decodeURIComponent(self.params[key]); }); //console.log('request.path', this.path); } module.exports = Request;