Skip to content

Commit 2c390ff

Browse files
blue86321gurgunday
andauthored
fix: hash loads json spec (#160)
* fix: resolveUrl hash * test: case for hash loads json spec * fix: split 1 Co-authored-by: Gürgün Dayıoğlu <hey@gurgun.day> Signed-off-by: Chun-Wei Chang <50546951+blue86321@users.noreply.github.com> --------- Signed-off-by: Chun-Wei Chang <50546951+blue86321@users.noreply.github.com> Co-authored-by: Gürgün Dayıoğlu <hey@gurgun.day>
1 parent 52d7d3f commit 2c390ff

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Diff for: e2e/custom.test.js

+9
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,13 @@ test.describe('Check redirection and url handling of static assets', () => {
7878
const jsonResponse = await jsonResponsePromise
7979
expect(jsonResponse.ok()).toBe(true)
8080
})
81+
82+
test('Check root UI with hash loads json spec', async ({ page }) => {
83+
const jsonResponsePromise = page.waitForResponse(/json/)
84+
await page.goto(`${URL_DOCUMENTATION}#default/get_example`)
85+
86+
// Check if the page has requested the json spec, and if so has it succeeded
87+
const jsonResponse = await jsonResponsePromise
88+
expect(jsonResponse.ok()).toBe(true)
89+
})
8190
})

Diff for: lib/swagger-initializer.js

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function swaggerInitializer (opts) {
2929
}
3030
function resolveUrl(url) {
3131
var currentHref = window.location.href;
32+
currentHref = currentHref.split('#', 1)[0];
3233
currentHref = currentHref.endsWith('/') ? currentHref : currentHref + '/';
3334
var anchor = document.createElement('a');
3435
anchor.href = currentHref + url;

0 commit comments

Comments
 (0)