Closed goleafs closed 10 years ago
all of our api endpoints are relative, e.g. var svc = $resource('/api/customers');
the batcher does not like this and ends up mutating calls to: http://pi/customers host: pi
I fixed this in the getUrlInfo - we can just use $location.host() and $location.provider() and the url coming in is already the relativeurl.
getUrlInfo = function (url) { return { protocol: constants.protocol, host: constants.host, relativeUrl: url }; }
and now this works with this configuration:
httpBatchConfigProvider.setAllowedBatchEndpoint('/api', '/api/batch');
It would probably be better to make this a configuration option and/or inspect the url more closely in getUrlInfo() to see if it is already relative in which case to use the $location protocol/host.
Add support for URL - please give it a test and see if it works for you. This has been pushed up to bower v1.3.0
all of our api endpoints are relative, e.g. var svc = $resource('/api/customers');
the batcher does not like this and ends up mutating calls to: http://pi/customers host: pi
I fixed this in the getUrlInfo - we can just use $location.host() and $location.provider() and the url coming in is already the relativeurl.
and now this works with this configuration:
It would probably be better to make this a configuration option and/or inspect the url more closely in getUrlInfo() to see if it is already relative in which case to use the $location protocol/host.