mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-09-14 10:52:34 +00:00
Fix cypress tests following user wizard changes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import express from "express";
|
||||
import { express as logger } from "../logger.js";
|
||||
import PACKAGE from "../package.json" with { type: "json" };
|
||||
import { getCompiledSchema } from "../schema/index.js";
|
||||
|
||||
@@ -18,21 +19,26 @@ router
|
||||
* GET /schema
|
||||
*/
|
||||
.get(async (req, res) => {
|
||||
const swaggerJSON = await getCompiledSchema();
|
||||
try {
|
||||
const swaggerJSON = await getCompiledSchema();
|
||||
|
||||
let proto = req.protocol;
|
||||
if (typeof req.headers["x-forwarded-proto"] !== "undefined" && req.headers["x-forwarded-proto"]) {
|
||||
proto = req.headers["x-forwarded-proto"];
|
||||
let proto = req.protocol;
|
||||
if (typeof req.headers["x-forwarded-proto"] !== "undefined" && req.headers["x-forwarded-proto"]) {
|
||||
proto = req.headers["x-forwarded-proto"];
|
||||
}
|
||||
|
||||
let origin = `${proto}://${req.hostname}`;
|
||||
if (typeof req.headers.origin !== "undefined" && req.headers.origin) {
|
||||
origin = req.headers.origin;
|
||||
}
|
||||
|
||||
swaggerJSON.info.version = PACKAGE.version;
|
||||
swaggerJSON.servers[0].url = `${origin}/api`;
|
||||
res.status(200).send(swaggerJSON);
|
||||
} catch (err) {
|
||||
logger.debug(`${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||
next(err);
|
||||
}
|
||||
|
||||
let origin = `${proto}://${req.hostname}`;
|
||||
if (typeof req.headers.origin !== "undefined" && req.headers.origin) {
|
||||
origin = req.headers.origin;
|
||||
}
|
||||
|
||||
swaggerJSON.info.version = PACKAGE.version;
|
||||
swaggerJSON.servers[0].url = `${origin}/api`;
|
||||
res.status(200).send(swaggerJSON);
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
Reference in New Issue
Block a user