waibu 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -3
- package/lib/handle-forward.js +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -22,7 +22,7 @@ async function factory (pkgName) {
|
|
|
22
22
|
this.dependencies = ['bajo-logger', 'bajo-extra']
|
|
23
23
|
this.config = {
|
|
24
24
|
server: {
|
|
25
|
-
|
|
25
|
+
address: '127.0.0.1',
|
|
26
26
|
port: 7771
|
|
27
27
|
},
|
|
28
28
|
factory: {
|
|
@@ -188,7 +188,7 @@ async function factory (pkgName) {
|
|
|
188
188
|
getOrigin = (req) => {
|
|
189
189
|
const { isEmpty } = this.lib._
|
|
190
190
|
let host = req.host
|
|
191
|
-
if (isEmpty(host) || host === ':authority') host = `${this.config.server.
|
|
191
|
+
if (isEmpty(host) || host === ':authority') host = `${this.config.server.address}:${this.config.server.port}`
|
|
192
192
|
return `${req.protocol}://${host}`
|
|
193
193
|
}
|
|
194
194
|
|
|
@@ -294,7 +294,7 @@ async function factory (pkgName) {
|
|
|
294
294
|
if (options.uriEncoded) url = url.split('/').map(u => encodeURI(u)).join('/')
|
|
295
295
|
info.qs = defaultsDeep({}, query, info.qs)
|
|
296
296
|
if (!isEmpty(info.qs)) url += '?' + this.qs.stringify(info.qs)
|
|
297
|
-
if (!url.startsWith('http') && guessHost) url = `http://${this.config.server.
|
|
297
|
+
if (!url.startsWith('http') && guessHost) url = `http://${this.config.server.address}:${this.config.server.port}/${trimStart(url, '/')}`
|
|
298
298
|
return url
|
|
299
299
|
}
|
|
300
300
|
|
package/lib/handle-forward.js
CHANGED
|
@@ -11,7 +11,7 @@ async function handleForward (ctx) {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const base = `http://${this.config.server.
|
|
14
|
+
const base = `http://${this.config.server.address}:${this.config.server.port}`
|
|
15
15
|
const options = defaultsDeep({ base }, this.config.forwardOpts)
|
|
16
16
|
await ctx.register(replyFrom, options)
|
|
17
17
|
|