-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
fetchModel functions failes to get the model when host and cqPath are passed as the url formed to fetch is incorrect
Package version
v2.1.0
To Reproduce
Steps to reproduce the behavior:
- invoke fetchModel({
cqPath,
host
})
where cqPath can be any path which can give json
and host where this can be used
example : fetch('https:/api.mockfly.dev/mocks/1a7495c9-1442-415f-b55c-5f5b3a2ed5f4/my-iqos-header.model.json')
Expected behavior
The fetch url should be correctly formed and work as expected to download json
in fetchModel.ts at line 58
const hostURL = sanitizeUrl(${host}/${path}).replace(//+/g, '/'); is the one causing the problem of replacing https:// to http:/ and due to which fetch for model.json fails
Better to replace this with
const fullUrl = new URL(cqPath, host).toString(); which gives the correct url
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working