UNPKG

879 BJavaScriptView Raw
1'use strict'
2
3function Request (params, req, query, headers, log, ip, ips, hostname) {
4 this.params = params
5 this.raw = req
6 this.query = query
7 this.headers = headers
8 this.log = log
9 this.body = null
10 this.ip = ip
11 this.ips = ips
12 this.hostname = hostname
13}
14
15function buildRequest (R) {
16 function _Request (params, req, query, headers, log, ip, ips, hostname) {
17 this.params = params
18 this.raw = req
19 this.query = query
20 this.headers = headers
21 this.log = log
22 this.body = null
23 this.ip = ip
24 this.ips = ips
25 this.hostname = hostname
26 }
27 _Request.prototype = new R()
28
29 return _Request
30}
31
32Object.defineProperties(Request.prototype, {
33 req: {
34 get: function () {
35 return this.raw
36 }
37 },
38 id: {
39 get: function () {
40 return this.raw.id
41 }
42 }
43})
44
45module.exports = Request
46module.exports.buildRequest = buildRequest