mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 12:36:02 +01:00
fix: subfolder handling in tests
This commit is contained in:
@@ -179,6 +179,11 @@ describe('API', async () => {
|
|||||||
if (!prefix && !dispatch.route.path.startsWith('/api/')) {
|
if (!prefix && !dispatch.route.path.startsWith('/api/')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prefix === nconf.get('relative_path')) {
|
||||||
|
prefix = '';
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
method: Object.keys(dispatch.route.methods)[0],
|
method: Object.keys(dispatch.route.methods)[0],
|
||||||
path: (prefix || '') + dispatch.route.path,
|
path: (prefix || '') + dispatch.route.path,
|
||||||
@@ -360,7 +365,8 @@ describe('API', async () => {
|
|||||||
if (http302 && response.statusCode === 302) {
|
if (http302 && response.statusCode === 302) {
|
||||||
// Compare headers instead
|
// Compare headers instead
|
||||||
const expectedHeaders = Object.keys(http302.headers).reduce((memo, name) => {
|
const expectedHeaders = Object.keys(http302.headers).reduce((memo, name) => {
|
||||||
memo[name] = http302.headers[name].schema.example;
|
const value = http302.headers[name].schema.example;
|
||||||
|
memo[name] = value.startsWith(nconf.get('relative_path')) ? value : nconf.get('relative_path') + value;
|
||||||
return memo;
|
return memo;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user