improvement: generate default oauth2RedirectUrl based on page location (via #5085)
This commit is contained in:
@@ -37,6 +37,7 @@ module.exports = function SwaggerUI(opts) {
|
|||||||
maxDisplayedTags: null,
|
maxDisplayedTags: null,
|
||||||
filter: null,
|
filter: null,
|
||||||
validatorUrl: "https://online.swagger.io/validator",
|
validatorUrl: "https://online.swagger.io/validator",
|
||||||
|
oauth2RedirectUrl: `${window.location.protocol}//${window.location.host}/oauth2-redirect.html`,
|
||||||
configs: {},
|
configs: {},
|
||||||
custom: {},
|
custom: {},
|
||||||
displayOperationId: false,
|
displayOperationId: false,
|
||||||
|
|||||||
@@ -2,4 +2,3 @@
|
|||||||
url: "https://petstore.swagger.io/v2/swagger.json"
|
url: "https://petstore.swagger.io/v2/swagger.json"
|
||||||
dom_id: "#swagger-ui"
|
dom_id: "#swagger-ui"
|
||||||
validatorUrl: "https://online.swagger.io/validator"
|
validatorUrl: "https://online.swagger.io/validator"
|
||||||
oauth2RedirectUrl: "http://localhost:3200/oauth2-redirect.html"
|
|
||||||
|
|||||||
10
test/e2e-cypress/tests/features/dynamic-default-oauth.js
Normal file
10
test/e2e-cypress/tests/features/dynamic-default-oauth.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
describe("dynamic default oauth2RedirectUrl", () => {
|
||||||
|
it("should render the OAS3 badge correctly", () => {
|
||||||
|
// This is a sanity check to make sure the badge is present.
|
||||||
|
// If this is failing, it's probably not related to #4865.
|
||||||
|
cy.visit("/")
|
||||||
|
.window()
|
||||||
|
.then(win => win.ui.getConfigs())
|
||||||
|
.should("include", { oauth2RedirectUrl: "http://localhost:3230/oauth2-redirect.html" })
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user