2017-03-21 11:24:11 +03:00
|
|
|
var should = require('should'), // jshint ignore:line
|
2016-09-09 13:23:47 +03:00
|
|
|
ghostUrl = require('../../shared/ghost-url'),
|
|
|
|
configUtils = require('../utils/configUtils'),
|
|
|
|
utils = require('../../server/utils');
|
2015-12-15 13:41:53 +03:00
|
|
|
|
2016-09-19 16:41:50 +03:00
|
|
|
// @TODO: ghostUrl.init was obviously written for this test, get rid of it! (write a route test instead)
|
2015-11-11 07:33:19 +03:00
|
|
|
describe('Ghost Ajax Helper', function () {
|
2015-12-15 13:41:53 +03:00
|
|
|
beforeEach(function () {
|
|
|
|
configUtils.set({
|
|
|
|
url: 'http://testblog.com/'
|
|
|
|
});
|
2015-11-11 07:33:19 +03:00
|
|
|
});
|
|
|
|
|
2015-12-15 13:41:53 +03:00
|
|
|
afterEach(function () {
|
|
|
|
configUtils.restore();
|
2015-11-11 07:33:19 +03:00
|
|
|
});
|
|
|
|
|
2015-12-15 17:16:00 +03:00
|
|
|
it('sets url empty if it is not set on init', function () {
|
|
|
|
ghostUrl.init({
|
|
|
|
clientId: '',
|
|
|
|
clientSecret: ''
|
|
|
|
});
|
|
|
|
|
|
|
|
ghostUrl.url.api().should.equal('');
|
|
|
|
});
|
|
|
|
|
2015-12-15 13:41:53 +03:00
|
|
|
it('renders basic url correctly when no arguments are presented', function () {
|
|
|
|
ghostUrl.init({
|
2015-11-11 07:33:19 +03:00
|
|
|
clientId: '',
|
2015-12-15 13:41:53 +03:00
|
|
|
clientSecret: '',
|
🔥✨ remove forceAdminSSL and urlSSL, add admin url (#7937)
* 🔥 kill apiUrl helper, use urlFor helper instead
More consistency of creating urls.
Creates an easier ability to add config changes.
Attention: urlFor function is getting a little nesty, BUT that is for now wanted to make easier and centralised changes to the configs.
The url util need's refactoring anyway.
* 🔥 urlSSL
Remove all urlSSL usages.
Add TODO's for the next commit to re-add logic for deleted logic.
e.g.
- cors helper generated an array of url's to allow requests from the defined config url's -> will be replaced by the admin url if available
- theme handler prefered the urlSSL in case it was defined -> will be replaced by using the urlFor helper to get the blog url (based on the request secure flag)
The changes in this commit doesn't have to be right, but it helped going step by step.
The next commit is the more interesting one.
* 🔥 ✨ remove forceAdminSSL, add new admin url and adapt logic
I wanted to remove the forceAdminSSL as separate commit, but was hard to realise.
That's why both changes are in one commit:
1. remove forceAdminSSL
2. add admin.url option
- fix TODO's from last commits
- rewrite the ssl middleware!
- create some private helper functions in the url helper to realise the changes
- rename some wordings and functions e.g. base === blog (we have so much different wordings)
- i would like to do more, but this would end in a non readable PR
- this commit contains the most important changes to offer admin.url option
* 🤖 adapt tests
IMPORTANT
- all changes in the routing tests were needed, because each routing test did not start the ghost server
- they just required the ghost application, which resulted in a random server port
- having a random server port results in a redirect, caused by the ssl/redirect middleware
* 😎 rename check-ssl middleware
* 🎨 fix theme-handler because of master rebase
2017-02-03 21:13:22 +03:00
|
|
|
url: utils.url.urlFor('api', {cors: true}, true)
|
2015-12-15 13:41:53 +03:00
|
|
|
});
|
2015-11-11 07:33:19 +03:00
|
|
|
|
2015-12-15 13:41:53 +03:00
|
|
|
ghostUrl.url.api().should.equal('//testblog.com/ghost/api/v0.1/');
|
2015-11-11 07:33:19 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
it('strips arguments of forward and trailing slashes correctly', function () {
|
2015-12-15 13:41:53 +03:00
|
|
|
ghostUrl.init({
|
2015-11-11 07:33:19 +03:00
|
|
|
clientId: '',
|
2015-12-15 13:41:53 +03:00
|
|
|
clientSecret: '',
|
🔥✨ remove forceAdminSSL and urlSSL, add admin url (#7937)
* 🔥 kill apiUrl helper, use urlFor helper instead
More consistency of creating urls.
Creates an easier ability to add config changes.
Attention: urlFor function is getting a little nesty, BUT that is for now wanted to make easier and centralised changes to the configs.
The url util need's refactoring anyway.
* 🔥 urlSSL
Remove all urlSSL usages.
Add TODO's for the next commit to re-add logic for deleted logic.
e.g.
- cors helper generated an array of url's to allow requests from the defined config url's -> will be replaced by the admin url if available
- theme handler prefered the urlSSL in case it was defined -> will be replaced by using the urlFor helper to get the blog url (based on the request secure flag)
The changes in this commit doesn't have to be right, but it helped going step by step.
The next commit is the more interesting one.
* 🔥 ✨ remove forceAdminSSL, add new admin url and adapt logic
I wanted to remove the forceAdminSSL as separate commit, but was hard to realise.
That's why both changes are in one commit:
1. remove forceAdminSSL
2. add admin.url option
- fix TODO's from last commits
- rewrite the ssl middleware!
- create some private helper functions in the url helper to realise the changes
- rename some wordings and functions e.g. base === blog (we have so much different wordings)
- i would like to do more, but this would end in a non readable PR
- this commit contains the most important changes to offer admin.url option
* 🤖 adapt tests
IMPORTANT
- all changes in the routing tests were needed, because each routing test did not start the ghost server
- they just required the ghost application, which resulted in a random server port
- having a random server port results in a redirect, caused by the ssl/redirect middleware
* 😎 rename check-ssl middleware
* 🎨 fix theme-handler because of master rebase
2017-02-03 21:13:22 +03:00
|
|
|
url: utils.url.urlFor('api', {cors: true}, true)
|
2015-12-15 13:41:53 +03:00
|
|
|
});
|
2015-11-11 07:33:19 +03:00
|
|
|
|
2015-12-15 13:41:53 +03:00
|
|
|
ghostUrl.url.api('a/', '/b', '/c/').should.equal('//testblog.com/ghost/api/v0.1/a/b/c/');
|
2015-11-11 07:33:19 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
it('appends client_id & client_secret to query string automatically', function () {
|
2015-12-15 13:41:53 +03:00
|
|
|
ghostUrl.init({
|
2015-11-11 07:33:19 +03:00
|
|
|
clientId: 'ghost-frontend',
|
2015-12-15 13:41:53 +03:00
|
|
|
clientSecret: 'notasecret',
|
🔥✨ remove forceAdminSSL and urlSSL, add admin url (#7937)
* 🔥 kill apiUrl helper, use urlFor helper instead
More consistency of creating urls.
Creates an easier ability to add config changes.
Attention: urlFor function is getting a little nesty, BUT that is for now wanted to make easier and centralised changes to the configs.
The url util need's refactoring anyway.
* 🔥 urlSSL
Remove all urlSSL usages.
Add TODO's for the next commit to re-add logic for deleted logic.
e.g.
- cors helper generated an array of url's to allow requests from the defined config url's -> will be replaced by the admin url if available
- theme handler prefered the urlSSL in case it was defined -> will be replaced by using the urlFor helper to get the blog url (based on the request secure flag)
The changes in this commit doesn't have to be right, but it helped going step by step.
The next commit is the more interesting one.
* 🔥 ✨ remove forceAdminSSL, add new admin url and adapt logic
I wanted to remove the forceAdminSSL as separate commit, but was hard to realise.
That's why both changes are in one commit:
1. remove forceAdminSSL
2. add admin.url option
- fix TODO's from last commits
- rewrite the ssl middleware!
- create some private helper functions in the url helper to realise the changes
- rename some wordings and functions e.g. base === blog (we have so much different wordings)
- i would like to do more, but this would end in a non readable PR
- this commit contains the most important changes to offer admin.url option
* 🤖 adapt tests
IMPORTANT
- all changes in the routing tests were needed, because each routing test did not start the ghost server
- they just required the ghost application, which resulted in a random server port
- having a random server port results in a redirect, caused by the ssl/redirect middleware
* 😎 rename check-ssl middleware
* 🎨 fix theme-handler because of master rebase
2017-02-03 21:13:22 +03:00
|
|
|
url: utils.url.urlFor('api', {cors: true}, true)
|
2015-12-15 13:41:53 +03:00
|
|
|
});
|
2015-11-11 07:33:19 +03:00
|
|
|
|
2015-12-15 13:41:53 +03:00
|
|
|
ghostUrl.url.api().should.equal('//testblog.com/ghost/api/v0.1/?client_id=ghost-frontend&client_secret=notasecret');
|
2015-11-11 07:33:19 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
it('generates query parameters correctly', function () {
|
2015-12-15 13:41:53 +03:00
|
|
|
ghostUrl.init({
|
2015-11-11 07:33:19 +03:00
|
|
|
clientId: 'ghost-frontend',
|
2015-12-15 13:41:53 +03:00
|
|
|
clientSecret: 'notasecret',
|
🔥✨ remove forceAdminSSL and urlSSL, add admin url (#7937)
* 🔥 kill apiUrl helper, use urlFor helper instead
More consistency of creating urls.
Creates an easier ability to add config changes.
Attention: urlFor function is getting a little nesty, BUT that is for now wanted to make easier and centralised changes to the configs.
The url util need's refactoring anyway.
* 🔥 urlSSL
Remove all urlSSL usages.
Add TODO's for the next commit to re-add logic for deleted logic.
e.g.
- cors helper generated an array of url's to allow requests from the defined config url's -> will be replaced by the admin url if available
- theme handler prefered the urlSSL in case it was defined -> will be replaced by using the urlFor helper to get the blog url (based on the request secure flag)
The changes in this commit doesn't have to be right, but it helped going step by step.
The next commit is the more interesting one.
* 🔥 ✨ remove forceAdminSSL, add new admin url and adapt logic
I wanted to remove the forceAdminSSL as separate commit, but was hard to realise.
That's why both changes are in one commit:
1. remove forceAdminSSL
2. add admin.url option
- fix TODO's from last commits
- rewrite the ssl middleware!
- create some private helper functions in the url helper to realise the changes
- rename some wordings and functions e.g. base === blog (we have so much different wordings)
- i would like to do more, but this would end in a non readable PR
- this commit contains the most important changes to offer admin.url option
* 🤖 adapt tests
IMPORTANT
- all changes in the routing tests were needed, because each routing test did not start the ghost server
- they just required the ghost application, which resulted in a random server port
- having a random server port results in a redirect, caused by the ssl/redirect middleware
* 😎 rename check-ssl middleware
* 🎨 fix theme-handler because of master rebase
2017-02-03 21:13:22 +03:00
|
|
|
url: utils.url.urlFor('api', {cors: true}, true)
|
2015-12-15 13:41:53 +03:00
|
|
|
});
|
2015-11-11 07:33:19 +03:00
|
|
|
|
2015-12-15 13:41:53 +03:00
|
|
|
var rendered = ghostUrl.url.api({a: 'string', b: 5, c: 'en coded'});
|
2015-11-11 07:33:19 +03:00
|
|
|
|
2015-12-15 13:41:53 +03:00
|
|
|
rendered.should.match(/\/\/testblog\.com\/ghost\/api\/v0\.1\/\?/);
|
2015-11-11 07:33:19 +03:00
|
|
|
rendered.should.match(/client_id=ghost-frontend/);
|
|
|
|
rendered.should.match(/client_secret=notasecret/);
|
|
|
|
rendered.should.match(/a/);
|
|
|
|
rendered.should.match(/b=5/);
|
|
|
|
rendered.should.match(/c=en\%20coded/);
|
|
|
|
});
|
|
|
|
|
2016-02-29 09:25:38 +03:00
|
|
|
it('handles null/undefined queryOptions correctly', function () {
|
|
|
|
ghostUrl.init({
|
|
|
|
clientId: 'ghost-frontend',
|
|
|
|
clientSecret: 'notasecret',
|
|
|
|
url: 'test'
|
|
|
|
});
|
|
|
|
|
|
|
|
var test = {
|
|
|
|
a: null
|
|
|
|
},
|
|
|
|
rendered = ghostUrl.url.api(test.a), // null value
|
|
|
|
rendered2 = ghostUrl.url.api(test.b); // undefined value
|
|
|
|
|
|
|
|
rendered.should.match(/test/);
|
|
|
|
rendered.should.match(/client_id=ghost-frontend/);
|
|
|
|
rendered.should.match(/client_secret=notasecret/);
|
|
|
|
rendered2.should.match(/test/);
|
|
|
|
rendered2.should.match(/client_id=ghost-frontend/);
|
|
|
|
rendered2.should.match(/client_secret=notasecret/);
|
|
|
|
});
|
|
|
|
|
2015-11-11 07:33:19 +03:00
|
|
|
it('generates complex query correctly', function () {
|
2015-12-15 13:41:53 +03:00
|
|
|
ghostUrl.init({
|
|
|
|
clientId: 'ghost-frontend',
|
|
|
|
clientSecret: 'notasecret',
|
🔥✨ remove forceAdminSSL and urlSSL, add admin url (#7937)
* 🔥 kill apiUrl helper, use urlFor helper instead
More consistency of creating urls.
Creates an easier ability to add config changes.
Attention: urlFor function is getting a little nesty, BUT that is for now wanted to make easier and centralised changes to the configs.
The url util need's refactoring anyway.
* 🔥 urlSSL
Remove all urlSSL usages.
Add TODO's for the next commit to re-add logic for deleted logic.
e.g.
- cors helper generated an array of url's to allow requests from the defined config url's -> will be replaced by the admin url if available
- theme handler prefered the urlSSL in case it was defined -> will be replaced by using the urlFor helper to get the blog url (based on the request secure flag)
The changes in this commit doesn't have to be right, but it helped going step by step.
The next commit is the more interesting one.
* 🔥 ✨ remove forceAdminSSL, add new admin url and adapt logic
I wanted to remove the forceAdminSSL as separate commit, but was hard to realise.
That's why both changes are in one commit:
1. remove forceAdminSSL
2. add admin.url option
- fix TODO's from last commits
- rewrite the ssl middleware!
- create some private helper functions in the url helper to realise the changes
- rename some wordings and functions e.g. base === blog (we have so much different wordings)
- i would like to do more, but this would end in a non readable PR
- this commit contains the most important changes to offer admin.url option
* 🤖 adapt tests
IMPORTANT
- all changes in the routing tests were needed, because each routing test did not start the ghost server
- they just required the ghost application, which resulted in a random server port
- having a random server port results in a redirect, caused by the ssl/redirect middleware
* 😎 rename check-ssl middleware
* 🎨 fix theme-handler because of master rebase
2017-02-03 21:13:22 +03:00
|
|
|
url: utils.url.urlFor('api', {cors: true}, true)
|
2015-12-15 13:41:53 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
var rendered = ghostUrl.url.api('posts/', '/tags/', '/count', {include: 'tags,tests', page: 2});
|
|
|
|
|
|
|
|
rendered.should.match(/\/\/testblog\.com\/ghost\/api\/v0\.1\/posts\/tags\/count\/\?/);
|
|
|
|
rendered.should.match(/client_id=ghost-frontend/);
|
|
|
|
rendered.should.match(/client_secret=notasecret/);
|
|
|
|
rendered.should.match(/include=tags%2Ctests/);
|
|
|
|
rendered.should.match(/page=2/);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('works with an https config', function () {
|
|
|
|
configUtils.set({
|
|
|
|
url: 'https://testblog.com/'
|
|
|
|
});
|
🔥✨ remove forceAdminSSL and urlSSL, add admin url (#7937)
* 🔥 kill apiUrl helper, use urlFor helper instead
More consistency of creating urls.
Creates an easier ability to add config changes.
Attention: urlFor function is getting a little nesty, BUT that is for now wanted to make easier and centralised changes to the configs.
The url util need's refactoring anyway.
* 🔥 urlSSL
Remove all urlSSL usages.
Add TODO's for the next commit to re-add logic for deleted logic.
e.g.
- cors helper generated an array of url's to allow requests from the defined config url's -> will be replaced by the admin url if available
- theme handler prefered the urlSSL in case it was defined -> will be replaced by using the urlFor helper to get the blog url (based on the request secure flag)
The changes in this commit doesn't have to be right, but it helped going step by step.
The next commit is the more interesting one.
* 🔥 ✨ remove forceAdminSSL, add new admin url and adapt logic
I wanted to remove the forceAdminSSL as separate commit, but was hard to realise.
That's why both changes are in one commit:
1. remove forceAdminSSL
2. add admin.url option
- fix TODO's from last commits
- rewrite the ssl middleware!
- create some private helper functions in the url helper to realise the changes
- rename some wordings and functions e.g. base === blog (we have so much different wordings)
- i would like to do more, but this would end in a non readable PR
- this commit contains the most important changes to offer admin.url option
* 🤖 adapt tests
IMPORTANT
- all changes in the routing tests were needed, because each routing test did not start the ghost server
- they just required the ghost application, which resulted in a random server port
- having a random server port results in a redirect, caused by the ssl/redirect middleware
* 😎 rename check-ssl middleware
* 🎨 fix theme-handler because of master rebase
2017-02-03 21:13:22 +03:00
|
|
|
|
2015-12-15 13:41:53 +03:00
|
|
|
ghostUrl.init({
|
|
|
|
clientId: 'ghost-frontend',
|
|
|
|
clientSecret: 'notasecret',
|
🔥✨ remove forceAdminSSL and urlSSL, add admin url (#7937)
* 🔥 kill apiUrl helper, use urlFor helper instead
More consistency of creating urls.
Creates an easier ability to add config changes.
Attention: urlFor function is getting a little nesty, BUT that is for now wanted to make easier and centralised changes to the configs.
The url util need's refactoring anyway.
* 🔥 urlSSL
Remove all urlSSL usages.
Add TODO's for the next commit to re-add logic for deleted logic.
e.g.
- cors helper generated an array of url's to allow requests from the defined config url's -> will be replaced by the admin url if available
- theme handler prefered the urlSSL in case it was defined -> will be replaced by using the urlFor helper to get the blog url (based on the request secure flag)
The changes in this commit doesn't have to be right, but it helped going step by step.
The next commit is the more interesting one.
* 🔥 ✨ remove forceAdminSSL, add new admin url and adapt logic
I wanted to remove the forceAdminSSL as separate commit, but was hard to realise.
That's why both changes are in one commit:
1. remove forceAdminSSL
2. add admin.url option
- fix TODO's from last commits
- rewrite the ssl middleware!
- create some private helper functions in the url helper to realise the changes
- rename some wordings and functions e.g. base === blog (we have so much different wordings)
- i would like to do more, but this would end in a non readable PR
- this commit contains the most important changes to offer admin.url option
* 🤖 adapt tests
IMPORTANT
- all changes in the routing tests were needed, because each routing test did not start the ghost server
- they just required the ghost application, which resulted in a random server port
- having a random server port results in a redirect, caused by the ssl/redirect middleware
* 😎 rename check-ssl middleware
* 🎨 fix theme-handler because of master rebase
2017-02-03 21:13:22 +03:00
|
|
|
url: utils.url.urlFor('api', true)
|
2015-12-15 13:41:53 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
var rendered = ghostUrl.url.api('posts/', '/tags/', '/count', {include: 'tags,tests', page: 2});
|
|
|
|
|
|
|
|
rendered.should.match(/https:\/\/testblog\.com\/ghost\/api\/v0\.1\/posts\/tags\/count\/\?/);
|
|
|
|
rendered.should.match(/client_id=ghost-frontend/);
|
|
|
|
rendered.should.match(/client_secret=notasecret/);
|
|
|
|
rendered.should.match(/include=tags%2Ctests/);
|
|
|
|
rendered.should.match(/page=2/);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('works with an https config and subdirectory', function () {
|
|
|
|
configUtils.set({
|
|
|
|
url: 'https://testblog.com/blog/'
|
|
|
|
});
|
|
|
|
ghostUrl.init({
|
2015-11-11 07:33:19 +03:00
|
|
|
clientId: 'ghost-frontend',
|
2015-12-15 13:41:53 +03:00
|
|
|
clientSecret: 'notasecret',
|
🔥✨ remove forceAdminSSL and urlSSL, add admin url (#7937)
* 🔥 kill apiUrl helper, use urlFor helper instead
More consistency of creating urls.
Creates an easier ability to add config changes.
Attention: urlFor function is getting a little nesty, BUT that is for now wanted to make easier and centralised changes to the configs.
The url util need's refactoring anyway.
* 🔥 urlSSL
Remove all urlSSL usages.
Add TODO's for the next commit to re-add logic for deleted logic.
e.g.
- cors helper generated an array of url's to allow requests from the defined config url's -> will be replaced by the admin url if available
- theme handler prefered the urlSSL in case it was defined -> will be replaced by using the urlFor helper to get the blog url (based on the request secure flag)
The changes in this commit doesn't have to be right, but it helped going step by step.
The next commit is the more interesting one.
* 🔥 ✨ remove forceAdminSSL, add new admin url and adapt logic
I wanted to remove the forceAdminSSL as separate commit, but was hard to realise.
That's why both changes are in one commit:
1. remove forceAdminSSL
2. add admin.url option
- fix TODO's from last commits
- rewrite the ssl middleware!
- create some private helper functions in the url helper to realise the changes
- rename some wordings and functions e.g. base === blog (we have so much different wordings)
- i would like to do more, but this would end in a non readable PR
- this commit contains the most important changes to offer admin.url option
* 🤖 adapt tests
IMPORTANT
- all changes in the routing tests were needed, because each routing test did not start the ghost server
- they just required the ghost application, which resulted in a random server port
- having a random server port results in a redirect, caused by the ssl/redirect middleware
* 😎 rename check-ssl middleware
* 🎨 fix theme-handler because of master rebase
2017-02-03 21:13:22 +03:00
|
|
|
url: utils.url.urlFor('api', true)
|
2015-12-15 13:41:53 +03:00
|
|
|
});
|
2015-11-11 07:33:19 +03:00
|
|
|
|
2015-12-15 13:41:53 +03:00
|
|
|
var rendered = ghostUrl.url.api('posts/', '/tags/', '/count', {include: 'tags,tests', page: 2});
|
2015-11-11 07:33:19 +03:00
|
|
|
|
|
|
|
rendered.should.match(/https:\/\/testblog\.com\/blog\/ghost\/api\/v0\.1\/posts\/tags\/count\/\?/);
|
|
|
|
rendered.should.match(/client_id=ghost-frontend/);
|
|
|
|
rendered.should.match(/client_secret=notasecret/);
|
|
|
|
rendered.should.match(/include=tags%2Ctests/);
|
|
|
|
rendered.should.match(/page=2/);
|
|
|
|
});
|
2015-12-18 12:15:24 +03:00
|
|
|
|
|
|
|
it('should be idempotent', function () {
|
|
|
|
configUtils.set({
|
|
|
|
url: 'https://testblog.com/blog/'
|
|
|
|
});
|
2016-09-09 13:23:47 +03:00
|
|
|
|
2015-12-18 12:15:24 +03:00
|
|
|
ghostUrl.init({
|
|
|
|
clientId: 'ghost-frontend',
|
|
|
|
clientSecret: 'notasecret',
|
🔥✨ remove forceAdminSSL and urlSSL, add admin url (#7937)
* 🔥 kill apiUrl helper, use urlFor helper instead
More consistency of creating urls.
Creates an easier ability to add config changes.
Attention: urlFor function is getting a little nesty, BUT that is for now wanted to make easier and centralised changes to the configs.
The url util need's refactoring anyway.
* 🔥 urlSSL
Remove all urlSSL usages.
Add TODO's for the next commit to re-add logic for deleted logic.
e.g.
- cors helper generated an array of url's to allow requests from the defined config url's -> will be replaced by the admin url if available
- theme handler prefered the urlSSL in case it was defined -> will be replaced by using the urlFor helper to get the blog url (based on the request secure flag)
The changes in this commit doesn't have to be right, but it helped going step by step.
The next commit is the more interesting one.
* 🔥 ✨ remove forceAdminSSL, add new admin url and adapt logic
I wanted to remove the forceAdminSSL as separate commit, but was hard to realise.
That's why both changes are in one commit:
1. remove forceAdminSSL
2. add admin.url option
- fix TODO's from last commits
- rewrite the ssl middleware!
- create some private helper functions in the url helper to realise the changes
- rename some wordings and functions e.g. base === blog (we have so much different wordings)
- i would like to do more, but this would end in a non readable PR
- this commit contains the most important changes to offer admin.url option
* 🤖 adapt tests
IMPORTANT
- all changes in the routing tests were needed, because each routing test did not start the ghost server
- they just required the ghost application, which resulted in a random server port
- having a random server port results in a redirect, caused by the ssl/redirect middleware
* 😎 rename check-ssl middleware
* 🎨 fix theme-handler because of master rebase
2017-02-03 21:13:22 +03:00
|
|
|
url: utils.url.urlFor('api', {cors: true}, true)
|
2015-12-18 12:15:24 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
var rendered = ghostUrl.url.api('posts', {limit: 3}),
|
|
|
|
rendered2 = ghostUrl.url.api('posts', {limit: 3});
|
|
|
|
|
|
|
|
rendered.should.equal(rendered2);
|
|
|
|
});
|
2015-11-11 07:33:19 +03:00
|
|
|
});
|