diff --git a/index.js b/index.js index 965778a..f4f16e8 100644 --- a/index.js +++ b/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'] || '') diff --git a/package.json b/package.json index 994ad0e..c1151b1 100644 --- a/package.json +++ b/package.json @@ -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"