增加hostname
parent
2203b683f5
commit
9d66a77b4d
2
index.js
2
index.js
|
@ -51,6 +51,7 @@ export default class Request {
|
|||
|
||||
url = ''
|
||||
host = '127.0.0.1'
|
||||
hostname = '127.0.0.1'
|
||||
protocol = 'http'
|
||||
|
||||
constructor(req, res, opts = {}) {
|
||||
|
@ -60,6 +61,7 @@ export default class Request {
|
|||
this.#res = res
|
||||
|
||||
this.host = req.headers['host'] || '127.0.0.1'
|
||||
this.hostname = this.host.split(':')[0]
|
||||
this.protocol = req.headers['x-forwarded-proto'] || 'http'
|
||||
|
||||
this.#cookies = parseCookie(this.headers['cookie'] || '')
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@gm5/request",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.4",
|
||||
"description": "对Http的Request进一步封装, 提供常用的API",
|
||||
"main": "index.js",
|
||||
"author": "yutent",
|
||||
|
@ -15,8 +15,8 @@
|
|||
"http"
|
||||
],
|
||||
"dependencies": {
|
||||
"es.shim": "^2.0.1",
|
||||
"iofs": "^1.5.0"
|
||||
"es.shim": "^2.2.0",
|
||||
"iofs": "^1.5.3"
|
||||
},
|
||||
"repository": "https://git.wkit.fun/gm5/request.git",
|
||||
"license": "MIT"
|
||||
|
|
Loading…
Reference in New Issue