Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/ng/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,10 @@ function $HttpProvider() {
throw minErr('$http')('badreq', 'Http request configuration must be an object. Received: {0}', requestConfig);
}

if (!isString(requestConfig.url)) {
throw minErr('$http')('badreq', 'Http request configuration url must be a string. Received: {0}', requestConfig.url);
}

var config = extend({
method: 'get',
transformRequest: defaults.transformRequest,
Expand Down
7 changes: 7 additions & 0 deletions test/ng/httpSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,13 @@ describe('$http', function() {
}).toThrowMinErr('$http','badreq', 'Http request configuration must be an object. Received: /url');
});

it('should throw error if the request configuration url is not a string', function() {
expect(function() {
$http({ url : false});
}).toThrowMinErr('$http','badreq', 'Http request configuration url must be a string. Received: false');
});


it('should send GET requests if no method specified', function() {
$httpBackend.expect('GET', '/url').respond('');
$http({url: '/url'});
Expand Down