feat(cli,run): resolve app url based on available network interfaces
This commit is contained in:
@ -26,11 +26,21 @@ describe('App Module', function() {
|
||||
})
|
||||
});
|
||||
|
||||
it('should retrieve requested app url', function() {
|
||||
it('should retrieve requested app url without from address', function() {
|
||||
return Edge.rpc("getAppUrl", { appId: "edge.sdk.client.test" })
|
||||
.then(url => {
|
||||
console.log("getAppUrl result:", url);
|
||||
chai.assert.isNotEmpty(url);
|
||||
chai.assert.match(url, /^http:\/\/0\.0\.0\.0/)
|
||||
})
|
||||
});
|
||||
|
||||
it('should retrieve requested app url with from address', function() {
|
||||
return Edge.rpc("getAppUrl", { appId: "edge.sdk.client.test", from: "127.0.0.2" })
|
||||
.then(url => {
|
||||
console.log("getAppUrl result:", url);
|
||||
chai.assert.isNotEmpty(url);
|
||||
chai.assert.match(url, /^http:\/\/127\.0\.0\.1/)
|
||||
})
|
||||
});
|
||||
|
||||
|
@ -96,7 +96,9 @@ function getApp(ctx, params) {
|
||||
|
||||
function getAppUrl(ctx, params) {
|
||||
var appId = params.appId;
|
||||
return app.getUrl(ctx, appId);
|
||||
var from = params.from;
|
||||
|
||||
return app.getUrl(ctx, appId, from ? from : '');
|
||||
}
|
||||
|
||||
function onClientFetch(ctx, url, remoteAddr) {
|
||||
|
Reference in New Issue
Block a user