You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
879 B
47 lines
879 B
4 years ago
|
'use strict'
|
||
|
|
||
|
function Request (params, req, query, headers, log, ip, ips, hostname) {
|
||
|
this.params = params
|
||
|
this.raw = req
|
||
|
this.query = query
|
||
|
this.headers = headers
|
||
|
this.log = log
|
||
|
this.body = null
|
||
|
this.ip = ip
|
||
|
this.ips = ips
|
||
|
this.hostname = hostname
|
||
|
}
|
||
|
|
||
|
function buildRequest (R) {
|
||
|
function _Request (params, req, query, headers, log, ip, ips, hostname) {
|
||
|
this.params = params
|
||
|
this.raw = req
|
||
|
this.query = query
|
||
|
this.headers = headers
|
||
|
this.log = log
|
||
|
this.body = null
|
||
|
this.ip = ip
|
||
|
this.ips = ips
|
||
|
this.hostname = hostname
|
||
|
}
|
||
|
_Request.prototype = new R()
|
||
|
|
||
|
return _Request
|
||
|
}
|
||
|
|
||
|
Object.defineProperties(Request.prototype, {
|
||
|
req: {
|
||
|
get: function () {
|
||
|
return this.raw
|
||
|
}
|
||
|
},
|
||
|
id: {
|
||
|
get: function () {
|
||
|
return this.raw.id
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
|
||
|
module.exports = Request
|
||
|
module.exports.buildRequest = buildRequest
|