0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00: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:
Rish 2019-08-09 19:45:13 +05:30 committed by Rishabh Garg
parent 6ce9a5fc0e
commit 13a77363de
2 changed files with 2 additions and 2 deletions

View file

@ -22,7 +22,7 @@ const uncapitalise = (req, res, next) => {
let decodedURI;
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) {
pathToTest = isSignupOrReset[1];

View file

@ -125,7 +125,7 @@ describe('Middleware: uncapitalise', function () {
});
describe('An API request', function () {
['v0.1', 'v2', 'v10'].forEach((apiVersion) => {
['v0.1', 'v2', 'canary', 'v10'].forEach((apiVersion) => {
describe(`for ${apiVersion}`, function () {
it('does nothing if there are no capitals', function (done) {
req.path = `/ghost/api/${apiVersion}/endpoint/`;