Comments (3)
I found out where to hack it, but you probably want a more elegant fix that is configurable.
In the file client.js
see the lines marked <== FIXED
...
HAL.Http.Client.prototype.get = function(url) {
var self = this;
this.vent.trigger('location-change', { url: url });
var jqxhr = $.ajax({
url: 'http://localhost:8080'+url, // <== FIX
dataType: 'json',
success: function(resource, textStatus, jqXHR) {
...
});
};
HAL.Http.Client.prototype.request = function(opts) {
var self = this;
opts.dataType = 'json';
opts.url ='http://localhost:8080'+opts.url; // <== FIX
...
};
...
from hal-browser.
Isn't the "correct" answer here to follow Section 5 "Reference Resolution" of RFC 3986 "Uniform Resource Identifier (URI): Generic Syntax"?
The main issue, if I understand it, is establishing a base URI. But if I visit:
http://haltalk.herokuapp.com/explorer/browser.html#http://localhost:3000
It seems clear that the base URI is http://localhost:3000
(since that is the URI that the request was made to). So if the response from http://localhost:3000
includes a link of the form /foo
, shouldn't that be normalized into "http://localhost:3000/foo". The current version on Heroku simply attempts to use /foo
(which, I take it, is the issue you are concerned about?).
from hal-browser.
OK, so I had this same issue and I wasn't really able to test my API because it lacks support for handling relative URIs in the HAL API. The changes required are not actually in client.js
. The reason is that you need to have some context and client.js
doesn't have that. But I looked through the code and I adjusted things so that it resolves relative URIs at the time it renders the page in browser.html
.
I've submitted a pull request to adds support for relative URIs for anyone who is interested.
from hal-browser.
Related Issues (20)
- Accessing restricted rest resources using hal-browser HOT 5
- embedded resources not rendered if no curies are specified HOT 1
- Error when accessing example heroku app. HOT 3
- Add support for multiple levels of embedded Resource Objects HOT 2
- Make Beautiful HOT 1
- Third consecutive non-get request doesn't work
- Hal Browser demo doesn't work HOT 12
- CORS issue in recent versions HOT 1
- links with absolute URLs cause exceptions HOT 6
- Links in Properties view are not clickable HOT 5
- Support for nested "_embedded" items HOT 1
- 500 Internal Server Error on http://haltalk.herokuapp.com HOT 5
- Support links as list
- Add ability to change users HOT 2
- How to include it in a react app HOT 2
- Getting HEAD url 405 () error when clicking on NON-GET HOT 1
- Custom Request Headers not sent for NON-GET requests HOT 3
- Why is .gitignore excluding html files HOT 2
- Cross Site Scripting issue with NON-GET dialog HOT 1
- Hal browser uses jQuery version that contains a CVE HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hal-browser.