Skip to content

Commit 6c224ff

Browse files
author
kellyselden
committed
add rootURL support to redirects
1 parent 057db5a commit 6c224ff

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

app/locations/none.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ export default Ember.NoneLocation.extend({
3737
if (isTransitioning && !isInitialPath) {
3838
let protocol = get(this, '_request.protocol');
3939
let host = get(this, '_request.host');
40+
let rootURL = get(this, 'rootURL');
41+
rootURL = rootURL.substr(0, rootURL.length - 1);
42+
path = `${rootURL}${path}`;
4043
let redirectURL = `${protocol}://${host}${path}`;
4144

4245
response.statusCode = this.get('_redirectCode');

test/fastboot-location-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ describe('FastBootLocation', function () {
7272
'location',
7373
'x-fastboot-path'
7474
]);
75-
expect(response.headers.location).to.equal('http://localhost:49741/test-passed');
76-
expect(response.headers['x-fastboot-path']).to.equal('/test-passed');
75+
expect(response.headers.location).to.equal('http://localhost:49741/my-root/test-passed');
76+
expect(response.headers['x-fastboot-path']).to.equal('/my-root/test-passed');
7777
expect(response.body).to.contain('Redirecting to');
78-
expect(response.body).to.contain('/test-passed');
78+
expect(response.body).to.contain('/my-root/test-passed');
7979
});
8080
});
8181

@@ -92,10 +92,10 @@ describe('FastBootLocation', function () {
9292
'location',
9393
'x-fastboot-path'
9494
]);
95-
expect(response.headers.location).to.equal('http://localhost:49741/test-passed');
96-
expect(response.headers['x-fastboot-path']).to.equal('/test-passed');
95+
expect(response.headers.location).to.equal('http://localhost:49741/my-root/test-passed');
96+
expect(response.headers['x-fastboot-path']).to.equal('/my-root/test-passed');
9797
expect(response.body).to.contain('Redirecting to');
98-
expect(response.body).to.contain('/test-passed');
98+
expect(response.body).to.contain('/my-root/test-passed');
9999
});
100100
});
101101
});

0 commit comments

Comments
 (0)