-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Steps to Reproduce
- Create a new Yasgui instance, where
endpointin the requestConfig provides a path on the same origin, rather than a full URL. For example:
import Yasgui from "@zazuko/yasgui";
import "@zazuko/yasgui/build/yasgui.min.css";
new Yasgui(document.getElementById("yasgui"), {
requestConfig: { endpoint: "/sparql" },
copyEndpointOnNewTab: false,
});
- Make a request through Yasgui which returns a HTTP error (eg a 5xx caused by a query timeout).
Expected Behaviour
The body of the erroring HTTP response to be shown in the UI, eg:
Actual Behaviour
Nothing is show in the response section of the UI.
The following error is logged in the browser's console:
yasgui.min.js:2 Uncaught (in promise) TypeError: Failed to construct 'URL': Invalid URL
at yasgui.min.js:2:983497
at f (yasgui.min.js:2:780774)
at Generator.<anonymous> (yasgui.min.js:2:782097)
at Generator.next (yasgui.min.js:2:781184)
at yasgui.min.js:2:971919
at new Promise (<anonymous>)
at yasgui.min.js:2:971664
at yasgui.min.js:2:983337
at t.<anonymous> (yasgui.min.js:2:136769)
at f (yasgui.min.js:2:780774)
Workaround
Add window.location.origin to the start of the endpoint.
import Yasgui from "@zazuko/yasgui";
import "@zazuko/yasgui/build/yasgui.min.css";
new Yasgui(document.getElementById("yasgui"), {
requestConfig: { endpoint: window.location.origin+"/sparql" },
copyEndpointOnNewTab: false,
});
It's unclear from the documentation whether the endpoint parameter is intended to only work for absolute URLs, or if relative ones are acceptable too. If there's meant to be a requirement for absolute URLs, I think it'd be more developer-friendly to check for that early on.
Metadata
Metadata
Assignees
Labels
No labels