Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Closed
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
5 changes: 3 additions & 2 deletions src/in-mem/backend.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,11 @@ export abstract class BackendService {
*/
protected getLocation(url: string): UriInfo {
if (!url.startsWith('http')) {
// get the document iff running in browser
// get the document if running in browser
const doc: Document = (typeof document === 'undefined') ? undefined : document;
// add host info to url before parsing. Use a fake host when not in browser.
const base = doc ? doc.location.protocol + '//' + doc.location.host : 'http://fake';
const { location } = doc;
const base = location ? location.protocol + '//' + location.host : 'http://fake';
url = url.startsWith('/') ? base + url : base + '/' + url;
}
return parseUri(url);
Expand Down