8000
We read every piece of feedback, and take your input very seriously.
2 parents 144c3da + 31b63e3 commit 3c185c4Copy full SHA for 3c185c4
src/restangular.js
@@ -1,9 +1,9 @@
1
(function (root, factory) {
2
// https://github.com/umdjs/umd/blob/master/templates/returnExports.js
3
if (typeof define === 'function' && define.amd) {
4
- define(['angular', 'lodash'], factory);
+ define(['lodash', 'angular'], factory);
5
} else if (typeof module === 'object' && module.exports) {
6
- module.exports = factory(require('angular'), require('lodash'));
+ module.exports = factory(require('lodash'), require('angular'));
7
} else {
8
// No global export, Restangular will register itself as Angular.js module
9
factory(root._, root.angular);
@@ -648,7 +648,7 @@ restangular.provider('Restangular', function() {
648
Path.prototype = new BaseCreator();
649
650
Path.prototype.normalizeUrl = function (url){
651
- var parts = /(http[s]?:\/\/)?(.*)?/.exec(url);
+ var parts = /((?:http[s]?:)?\/\/)?(.*)?/.exec(url);
652
parts[2] = parts[2].replace(/[\\\/]+/g, '/');
653
return (typeof parts[1] !== 'undefined')? parts[1] + parts[2] : parts[2];
654
};
test/restangularSpec.js
@@ -1149,5 +1149,16 @@ describe("Restangular", function() {
1149
1150
1151
});
1152
+
1153
+ it("Should work with absolute URL with //authority", function() {
1154
+ var newRes = Restangular.withConfig(function(RestangularConfigurer){
1155
+ RestangularConfigurer.setBaseUrl('//localhost:8080');
1156
+ });
1157
+ expect(newRes.configuration.baseUrl).toEqual('//localhost:8080');
1158
+ newRes.all("customers////").getList();
1159
+ $httpBackend.expectGET('//localhost:8080/customers/').respond([]);
1160
1161
+ $httpBackend.flush();
1162
1163
1164