mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Updated uncapitalise check to work with canary
no issue Previously uncapitalise check was based on fixed api endpoint format - v[NUMBER], this updates it to work with canary endpoint
This commit is contained in:
parent
6ce9a5fc0e
commit
13a77363de
2 changed files with 2 additions and 2 deletions
|
@ -22,7 +22,7 @@ const uncapitalise = (req, res, next) => {
|
||||||
let decodedURI;
|
let decodedURI;
|
||||||
|
|
||||||
const isSignupOrReset = pathToTest.match(/^(.*\/ghost\/(signup|reset)\/)/i),
|
const isSignupOrReset = pathToTest.match(/^(.*\/ghost\/(signup|reset)\/)/i),
|
||||||
isAPI = pathToTest.match(/^(.*\/ghost\/api\/v[\d.]+\/.*?\/)/i);
|
isAPI = pathToTest.match(/^(.*\/ghost\/api\/(v[\d.]+|canary)\/.*?\/)/i);
|
||||||
|
|
||||||
if (isSignupOrReset) {
|
if (isSignupOrReset) {
|
||||||
pathToTest = isSignupOrReset[1];
|
pathToTest = isSignupOrReset[1];
|
||||||
|
|
|
@ -125,7 +125,7 @@ describe('Middleware: uncapitalise', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('An API request', function () {
|
describe('An API request', function () {
|
||||||
['v0.1', 'v2', 'v10'].forEach((apiVersion) => {
|
['v0.1', 'v2', 'canary', 'v10'].forEach((apiVersion) => {
|
||||||
describe(`for ${apiVersion}`, function () {
|
describe(`for ${apiVersion}`, function () {
|
||||||
it('does nothing if there are no capitals', function (done) {
|
it('does nothing if there are no capitals', function (done) {
|
||||||
req.path = `/ghost/api/${apiVersion}/endpoint/`;
|
req.path = `/ghost/api/${apiVersion}/endpoint/`;
|
||||||
|
|
Loading…
Add table
Reference in a new issue