Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hash loads json spec #160

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions e2e/custom.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,13 @@ test.describe('Check redirection and url handling of static assets', () => {
const jsonResponse = await jsonResponsePromise
expect(jsonResponse.ok()).toBe(true)
})

test('Check root UI with hash loads json spec', async ({ page }) => {
const jsonResponsePromise = page.waitForResponse(/json/)
await page.goto(`${URL_DOCUMENTATION}#default/get_example`)

// Check if the page has requested the json spec, and if so has it succeeded
const jsonResponse = await jsonResponsePromise
expect(jsonResponse.ok()).toBe(true)
})
})
1 change: 1 addition & 0 deletions lib/swagger-initializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function swaggerInitializer (opts) {
}
function resolveUrl(url) {
var currentHref = window.location.href;
currentHref = currentHref.split('#', 1)[0];
currentHref = currentHref.endsWith('/') ? currentHref : currentHref + '/';
var anchor = document.createElement('a');
anchor.href = currentHref + url;
Expand Down
Loading